:root {
    --bg-dark: #f9fafb; /* Changed from dark to light bg */
    --bg-card: #ffffff;
    --bg-hover: #f3f4f6;
    
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    
    --accent: #667eea;
    --accent-hover: #764ba2;
    
    --priority-high: #ef4444;
    --priority-high-bg: rgba(239, 68, 68, 0.1);
    
    --priority-medium: #f59e0b;
    --priority-medium-bg: rgba(245, 158, 11, 0.1);
    
    --priority-low: #3b82f6;
    --priority-low-bg: rgba(59, 130, 246, 0.1);
    
    --border: #e5e7eb;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 1.5rem;
}

.header-content h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.header-content p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Tabs */
.tabs {
    display: flex;
    background: var(--bg-card);
    padding: 0.35rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 0.5rem 1.25rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.05);
}

.tab-btn.active {
    background: var(--accent);
    color: white;
}

.badge {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.1rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
}

.tab-btn.active .badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Controls */
.controls button {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    height: 40px;
    width: 40px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.controls button:hover {
    background: var(--bg-hover);
    transform: translateY(-1px);
}

.controls button:active {
    transform: translateY(1px);
}

/* Main content */
.ticket-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
}

.hidden {
    display: none !important;
}

/* Loader */
.loader-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50vh;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(59, 130, 246, 0.3);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty state / Error */
.empty-state, .error-message {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-card);
    border-radius: 1rem;
    border: 1px dashed var(--border);
    color: var(--text-secondary);
}

.empty-state svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.error-message {
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.05);
    border-style: solid;
}

/* Ticket Card */
.ticket-card {
    background: var(--bg-card);
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.ticket-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.ticket-card.priority-high::before,
.ticket-card.priority-urgent::before { background: var(--priority-high); }
.ticket-card.priority-medium::before { background: var(--priority-medium); }
.ticket-card.priority-low::before { background: var(--priority-low); }

.ticket-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.ticket-id {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: monospace;
    background: rgba(0,0,0,0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
}

.priority-badge {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    letter-spacing: 0.05em;
}

.priority-high-badge,
.priority-urgent-badge { background: var(--priority-high-bg); color: #fca5a5; }
.priority-medium-badge { background: var(--priority-medium-bg); color: #fcd34d; }
.priority-low-badge { background: var(--priority-low-bg); color: #93c5fd; }

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    /* Truncate text */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-app {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.app-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.date-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.actions {
    display: flex;
    gap: 0.5rem;
}

.action-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0,0,0,0.05);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
}

.action-link:hover {
    background: var(--accent);
    color: white;
}

.members {
    display: flex;
    gap: -0.5rem;
}

.member-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-hover);
    border: 2px solid var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    color: white;
    text-transform: uppercase;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.ticket-card {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
    }

    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .header-content h1 {
        font-size: 1.5rem;
    }

    .header-content p {
        font-size: 0.9rem;
    }

    .tabs {
        width: 100%;
        justify-content: space-between;
    }

    .tab-btn {
        flex: 1;
        justify-content: center;
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    .badge {
        font-size: 0.65rem;
        padding: 0.05rem 0.4rem;
    }

    .controls {
        position: fixed;
        bottom: 2rem;
        right: 1rem;
        z-index: 100;
    }

    .controls button {
        width: 48px;
        height: 48px;
    }

    .ticket-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .ticket-card {
        padding: 1rem;
        gap: 0.75rem;
    }

    .card-title {
        font-size: 1rem;
    }

    .card-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .empty-state,
    .error-message {
        padding: 2rem 1rem;
        font-size: 0.95rem;
    }

    .loader-container {
        min-height: 30vh;
    }
}
