:root {
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --accent: #f97316;
    --accent-light: #fb923c;
    --accent-dark: #ea580c;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --dark: #1f2937;
    --gray: #6b7280;
    --light: #f3f4f6;
    --white: #ffffff;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --sidebar-width: 260px;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

.login-card {
    background: var(--white);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}

.login-card h1 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 24px;
}

.login-card .subtitle {
    text-align: center;
    color: var(--gray);
    margin-bottom: 30px;
    font-size: 14px;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--dark);
    font-size: 14px;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--dark);
}

.btn-outline:hover {
    background: var(--light);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--dark);
    color: var(--white);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar-header img {
    max-width: 180px;
    height: auto;
    margin-bottom: 5px;
}

.sidebar-header small {
    display: block;
    color: var(--gray);
    font-size: 12px;
    margin-top: 5px;
}

.sidebar-nav {
    padding: 15px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 14px;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
    background: rgba(255,255,255,0.1);
    color: var(--white);
}

.sidebar-nav a .icon {
    width: 20px;
    text-align: center;
}

.sidebar-section {
    padding: 10px 20px 5px;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--gray);
    letter-spacing: 1px;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 0;
}

.topbar {
    background: var(--white);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left h1 {
    font-size: 20px;
    font-weight: 600;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.notification-btn {
    position: relative;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--gray);
}

.notification-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: var(--white);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.content {
    padding: 30px;
}

.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

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

.stat-card {
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 15px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--gray);
}

.table-responsive {
    overflow-x: auto;
}

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

table th, table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

table th {
    font-weight: 600;
    color: var(--gray);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table tr:hover {
    background: var(--light);
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: #f3f4f6; color: #374151; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-dark { background: #1f2937; color: white; }
.badge-danger { background: #fee2e2; color: #991b1b; }

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.ticket-detail {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

.ticket-info-row {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.ticket-info-row .label {
    font-weight: 500;
    color: var(--gray);
    min-width: 120px;
}

.message-item {
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 15px;
}

.message-item.internal {
    border-left: 3px solid var(--warning);
    background: #fffbeb;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--gray);
}

.message-author {
    font-weight: 600;
    color: var(--dark);
}

.attachment-list {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
}

.attachment-item:hover {
    text-decoration: underline;
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.file-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 15px;
    text-align: center;
    transition: box-shadow 0.2s;
}

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

.file-card .file-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.file-card .file-name {
    font-weight: 500;
    margin-bottom: 5px;
    word-break: break-word;
}

.file-card .file-meta {
    font-size: 12px;
    color: var(--gray);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: var(--dark);
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

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

    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 10px; }
