@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --primary-light: #EEF2FF;
    --bg: #F3F4F6;
    --surface: #FFFFFF;
    --text: #111827;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --error: #EF4444;
    --success: #10B981;
    --warning: #F59E0B;
    
    --sidebar-width: 260px;
    --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);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Authentication Layout */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
    position: relative;
    overflow: hidden;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.1) 0%, rgba(255,255,255,0) 70%);
    top: -200px;
    right: -200px;
    border-radius: 50%;
}

.auth-card {
    max-width: 420px;
    width: 100%;
    position: relative;
    z-index: 10;
    padding: 3rem 2.5rem;
}

.auth-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 2rem;
}

/* Admin / Staff Layout */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 50;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-nav {
    padding: 1.5rem 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-link:hover {
    background: var(--primary-light);
    color: var(--primary);
}

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

.sidebar-footer {
    padding: 1.5rem 1rem;
    border-top: 1px solid var(--border);
}

.main-content {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-header {
    background: var(--surface);
    height: 70px;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 40;
}

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

/* Old Header (for fallback/customer dashboard) */
.header {
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.header-brand { font-size: 1.25rem; font-weight: 700; color: var(--primary); }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* UI Elements */
.card {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    padding: 2rem;
    width: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(255,255,255,0.5);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.blue { background: #DBEAFE; color: #1D4ED8; }
.stat-icon.green { background: #D1FAE5; color: #047857; }
.stat-icon.yellow { background: #FEF3C7; color: #B45309; }
.stat-icon.gray { background: #F3F4F6; color: #4B5563; }

.stat-content h4 {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.stat-content .stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
}

/* Forms & Buttons */
.form-group { margin-bottom: 1.25rem; }
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
}
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s;
    background: #FAFAFA;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    background: var(--surface);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}
.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--bg);
    color: var(--primary);
    border-color: var(--primary);
}

/* Alerts */
.alert { padding: 1rem; border-radius: 8px; margin-bottom: 1.5rem; font-size: 0.875rem; font-weight: 500; }
.alert-error { background: #FEF2F2; color: var(--error); border: 1px solid #FCA5A5; }
.alert-success { background: #ECFDF5; color: var(--success); border: 1px solid #6EE7B7; }

/* Tickets */
.ticket-list {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid var(--border);
}

.ticket-item {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    transition: all 0.2s ease;
}
.ticket-item:hover {
    background: #F8FAFC;
}
.ticket-item:last-child { border-bottom: none; }

.ticket-info h3 { font-size: 1.125rem; margin-bottom: 0.35rem; }
.ticket-info h3 a { color: var(--text); text-decoration: none; transition: color 0.2s; }
.ticket-info h3 a:hover { color: var(--primary); }
.ticket-meta { font-size: 0.875rem; color: var(--text-muted); }

.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}
.badge-open { background: #DBEAFE; color: #1D4ED8; }
.badge-pending { background: #FEF3C7; color: #D97706; }
.badge-closed { background: #F3F4F6; color: #4B5563; }
.badge-company { background: #EEF2FF; color: var(--primary); }

/* Filters */
.filter-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.5rem;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    display: inline-flex;
}
.filter-link {
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s;
}
.filter-link:hover { color: var(--text); background: var(--bg); }
.filter-link.active { background: var(--primary); color: white; box-shadow: var(--shadow-sm); }

/* Layouts */
.grid-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    align-items: start;
}
@media (max-width: 992px) {
    .grid-layout { grid-template-columns: 1fr; }
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; }
}

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
a { color: var(--primary); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }

/* View Ticket */
.ticket-header { background: var(--surface); padding: 2rem; border-radius: 16px; box-shadow: var(--shadow-md); margin-bottom: 2rem; }
.reply-list { display: flex; flex-direction: column; gap: 1.5rem; margin-bottom: 2rem; }
.reply-card { background: var(--surface); padding: 1.5rem; border-radius: 16px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.reply-card.admin-reply { border-left: 4px solid var(--primary); background: #F8FAFC; }
.reply-header { display: flex; justify-content: space-between; margin-bottom: 1rem; font-size: 0.875rem; color: var(--text-muted); border-bottom: 1px solid var(--border); padding-bottom: 0.75rem; }
.reply-author { font-weight: 600; color: var(--text); }
.reply-content { line-height: 1.6; color: var(--text); white-space: pre-wrap; font-size: 0.95rem; }

/* Premium Customer Dashboard Custom CSS */
.dashboard-hero {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: white;
    border-radius: 20px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.3);
    position: relative;
    overflow: hidden;
}

.dashboard-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0) 70%);
    border-radius: 50%;
}

.dashboard-hero-title {
    font-size: 1.85rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.dashboard-hero-text {
    font-size: 1rem;
    opacity: 0.9;
    max-width: 600px;
}

.stats-card-premium {
    background: var(--surface);
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.stats-card-premium:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(79, 70, 229, 0.3);
}

.stats-icon-premium {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.stats-card-premium:hover .stats-icon-premium {
    transform: scale(1.1);
}

/* Custom Search Container */
.search-wrapper {
    position: relative;
    flex-grow: 1;
    max-width: 400px;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.2s ease;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 0.95rem;
    background: var(--surface);
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

.search-input:focus + .search-icon {
    color: var(--primary);
}

/* Premium Card Layout for Tickets */
.ticket-card-premium {
    background: var(--surface);
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 1.75rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ticket-card-premium:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(79, 70, 229, 0.2);
}

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

.ticket-card-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0;
}

.ticket-card-title a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s ease;
}

.ticket-card-title a:hover {
    color: var(--primary);
    text-decoration: none;
}

.ticket-card-snippet {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ticket-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #F3F4F6;
    padding-top: 0.85rem;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.ticket-card-meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.empty-state-card {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--surface);
    border-radius: 20px;
    border: 2px dashed var(--border);
    color: var(--text-muted);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem auto;
    font-size: 1.75rem;
}

/* User Profile Header Badge */
.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    background: #F3F4F6;
    border: 1px solid var(--border);
}

.user-avatar-initials {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-welcome-name {
    font-weight: 500;
    color: var(--text);
    font-size: 0.9rem;
}

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

.fade-in-el {
    animation: fadeIn 0.4s ease forwards;
}
