/* CSS Variables for Themes */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --background-start: #f5f7fa;
    --background-end: #e9ecef;
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.1);
    --text-primary: #333;
    --text-secondary: #666;
    --text-muted: #999;
    --hover-overlay: rgba(0, 0, 0, 0.03);
    --active-overlay: rgba(0, 0, 0, 0.06);
}

/* Theme: Midnight Ocean */
body[data-theme="midnight"] {
    --primary-gradient: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 50%, #14b8a6 100%);
    --background-start: #0c1222;
    --background-end: #1a2332;
    --glass-bg: rgba(12, 18, 34, 0.85);
    --glass-border: rgba(255, 255, 255, 0.15);
    --text-primary: rgba(255, 255, 255, 0.95);
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
}

/* Theme: Forest Green */
body[data-theme="forest"] {
    --primary-gradient: linear-gradient(135deg, #10b981 0%, #059669 50%, #047857 100%);
    --background-start: #0f1810;
    --background-end: #1a2618;
    --glass-bg: rgba(15, 24, 16, 0.85);
    --glass-border: rgba(16, 185, 129, 0.25);
    --text-primary: rgba(255, 255, 255, 0.95);
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
}

/* Theme: Sunset */
body[data-theme="sunset"] {
    --primary-gradient: linear-gradient(135deg, #f59e0b 0%, #f97316 50%, #ef4444 100%);
    --background-start: #1a1410;
    --background-end: #2a1f18;
    --glass-bg: rgba(26, 20, 16, 0.85);
    --glass-border: rgba(245, 158, 11, 0.25);
    --text-primary: rgba(255, 255, 255, 0.95);
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
}

/* Theme: Royal Purple */
body[data-theme="royal"] {
    --primary-gradient: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 50%, #6d28d9 100%);
    --background-start: #1a0f2e;
    --background-end: #2a1a3e;
    --glass-bg: rgba(26, 15, 46, 0.85);
    --glass-border: rgba(139, 92, 246, 0.25);
    --text-primary: rgba(255, 255, 255, 0.95);
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
}

/* Theme: Rose Gold */
body[data-theme="rose"] {
    --primary-gradient: linear-gradient(135deg, #ec4899 0%, #db2777 50%, #be185d 100%);
    --background-start: #1f0a14;
    --background-end: #2f1524;
    --glass-bg: rgba(31, 10, 20, 0.85);
    --glass-border: rgba(236, 72, 153, 0.25);
    --text-primary: rgba(255, 255, 255, 0.95);
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
}

/* Theme: Light Mode */
body[data-theme="light"] {
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    --background-start: #f8fafc;
    --background-end: #e2e8f0;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.08);
    --text-primary: #0f172a;
    --text-secondary: rgba(15, 23, 42, 0.7);
    --text-muted: rgba(15, 23, 42, 0.5);
    --hover-overlay: rgba(0, 0, 0, 0.03);
    --active-overlay: rgba(0, 0, 0, 0.06);
}

/* Theme: Arctic */
body[data-theme="arctic"] {
    --primary-gradient: linear-gradient(135deg, #06b6d4 0%, #0891b2 50%, #0e7490 100%);
    --background-start: #0a1419;
    --background-end: #152229;
    --glass-bg: rgba(10, 20, 25, 0.85);
    --glass-border: rgba(6, 182, 212, 0.25);
    --text-primary: rgba(255, 255, 255, 0.95);
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background-color: var(--background-start);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(to bottom right, var(--background-start), var(--background-end));
    background-color: var(--background-start);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background 0.5s ease, color 0.3s ease;
}

/* Navigation */
.portal-nav {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-icon {
    font-size: 28px;
    -webkit-text-fill-color: initial;
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--hover-overlay);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--primary-gradient);
    color: white;
}

.nav-link.logout {
    color: #dc2626;
}

.nav-link.logout:hover {
    background: rgba(220, 38, 38, 0.1);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

.welcome-section {
    margin-bottom: 32px;
}

.welcome-section h1 {
    font-size: 32px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.welcome-section p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* Stats Grid */
.stats-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 20px;
    margin-bottom: 32px;
    overflow-x: auto;
}

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--glass-border);
    text-align: center;
    border-left: 4px solid #667eea;
    flex: 1;
    min-width: 140px;
}

.stat-card.active {
    border-left-color: #f59e0b;
}

.stat-card.completed {
    border-left-color: #22c55e;
}

.stat-card.money {
    border-left-color: #8b5cf6;
}

.stat-card.due {
    border-left-color: #ef4444;
}

.stat-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Card */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    margin-bottom: 32px;
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--glass-border);
}

.card-header h2 {
    font-size: 20px;
    color: var(--text-primary);
}

.btn-link {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}

.btn-link:hover {
    text-decoration: underline;
}

/* Tickets List */
.tickets-list {
    padding: 12px;
}

.ticket-item {
    display: grid;
    grid-template-columns: 1fr auto 120px;
    gap: 20px;
    align-items: center;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    transition: all 0.2s;
    position: relative;
}

.ticket-item:hover {
    background: var(--hover-overlay);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ticket-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ticket-number {
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 16px;
}

.ticket-device {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
}

.ticket-issue {
    color: var(--text-secondary);
    font-size: 14px;
}

.ticket-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.status-new {
    background: #dbeafe;
    color: #1e40af;
}

.status-in-progress {
    background: #fef3c7;
    color: #92400e;
}

.status-waiting-for-parts {
    background: #fce7f3;
    color: #9f1239;
}

.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.ticket-date {
    color: var(--text-muted);
    font-size: 13px;
}

.ticket-cost {
    font-weight: 700;
    color: #22c55e;
    font-size: 16px;
}

.ticket-link {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s;
    text-align: right;
    white-space: nowrap;
}

.ticket-item:hover .ticket-link {
    opacity: 1;
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.5;
}

.alert-error {
    background: #fee;
    color: #c00;
    border: 1px solid #fcc;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Login Container */
.login-container {
    max-width: 450px;
    margin: 0 auto;
}

.login-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    padding: 48px 40px;
}

.login-card h1 {
    font-size: 28px;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Quick Actions */
.quick-actions {
    margin-top: 48px;
}

.quick-actions h2 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.action-card {
    background: var(--glass-bg);
    padding: 32px;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    text-decoration: none;
    transition: all 0.3s;
    border: 2px solid var(--glass-border);
}

.action-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.action-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.action-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.action-desc {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Detail Page */
.detail-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    border-radius: 16px;
    margin-bottom: 32px;
}

.detail-header h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.detail-header p {
    opacity: 0.9;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.info-item {
    background: var(--glass-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--glass-border);
}

.info-label {
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 8px;
}

.info-value {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid #f0f2f5;
}

.table th {
    background: var(--glass-bg);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
}

.table td {
    color: var(--text-primary);
}

.table .text-right {
    text-align: right;
}

.timeline {
    position: relative;
    padding-left: 40px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e5e7eb;
}

.timeline-item {
    position: relative;
    padding-bottom: 32px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -34px;
    top: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #667eea;
    border: 3px solid white;
    box-shadow: 0 0 0 2px #667eea;
}

.timeline-date {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 4px;
}

.timeline-content {
    background: var(--glass-bg);
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.timeline-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.timeline-desc {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        height: auto;
        padding: 16px 24px;
        gap: 16px;
    }

    .nav-links {
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
    }

    .welcome-section h1 {
        font-size: 24px;
    }

    .stat-card {
        min-width: 120px;
        padding: 16px;
    }

    .stat-icon {
        font-size: 32px;
    }

    .stat-value {
        font-size: 24px;
    }

    .stat-label {
        font-size: 12px;
    }

    .ticket-item {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .ticket-meta {
        align-items: flex-start;
    }

    .ticket-link {
        position: static;
        opacity: 1;
        margin-top: 8px;
    }

    .actions-grid {
        grid-template-columns: 1fr;
    }
}
