/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    line-height: 1.6;
    color: #1a1a2e;
    background: #f0f2f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: #4361ee;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* === Layout === */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
}

main.container {
    flex: 1;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

/* === Navbar === */
.navbar {
    background: #1a1a2e;
    padding: 0.75rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
}
.nav-brand:hover {
    text-decoration: none;
    color: #e2e8f0;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.nav-links a {
    color: #cbd5e1;
    font-size: 0.9rem;
}
.nav-links a:hover {
    color: #fff;
    text-decoration: none;
}

.nav-user {
    color: #94a3b8;
    font-size: 0.85rem;
    border-left: 1px solid #334155;
    padding-left: 1.25rem;
}

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #1a1a2e;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}
.btn:hover {
    background: #f1f5f9;
    text-decoration: none;
}

.btn-primary {
    background: #4361ee;
    color: #fff;
    border-color: #4361ee;
}
.btn-primary:hover {
    background: #3a56d4;
}

.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
}

.btn-active {
    background: #4361ee;
    color: #fff;
    border-color: #4361ee;
}

/* === Alerts === */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

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

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* === Page Header === */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

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

/* === Filters === */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.filter-user-form {
    margin-left: auto;
}

.filter-user-form select {
    padding: 0.3rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85rem;
    background: #fff;
}

/* === Tables === */
.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.table th, .table td {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

.table thead {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

.table th {
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.sortable th a {
    color: #475569;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}
.sortable th a:hover {
    color: #1a1a2e;
    text-decoration: none;
}

.sort-icon {
    font-size: 0.7rem;
    color: #cbd5e1;
}
.sort-icon.active {
    color: #4361ee;
}

.table tbody tr {
    border-bottom: 1px solid #f1f5f9;
}
.table tbody tr:hover {
    background: #f8fafc;
}

/* === Badges === */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-open {
    background: #dbeafe;
    color: #1e40af;
}
.badge-in_progress {
    background: #fef3c7;
    color: #92400e;
}
.badge-closed {
    background: #d1fae5;
    color: #065f46;
}

.priority-low {
    background: #e0e7ff;
    color: #3730a3;
}
.priority-medium {
    background: #fef3c7;
    color: #92400e;
}
.priority-high {
    background: #fee2e2;
    color: #991b1b;
}

/* === Forms === */
.form-container {
    max-width: 500px;
    margin: 0 auto;
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.form-container h1,
.form-container h2 {
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
}

.form-container h2 {
    font-size: 1.2rem;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.form-row .form-group {
    flex: 1;
    min-width: 150px;
    margin-bottom: 0;
}

.form-row .form-group-btn {
    flex: 0 0 auto;
    min-width: auto;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: #374151;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67,97,238,0.15);
}

.form-hint {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.8rem;
    color: #94a3b8;
}

.multi-select {
    min-height: 5rem;
}

.form-footer {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #64748b;
}

/* === Ticket Detail === */
.ticket-detail {
    background: #fff;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.ticket-header h1 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.ticket-id {
    color: #94a3b8;
    font-weight: 400;
}

.ticket-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 1.5rem;
}

.ticket-assignees {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #64748b;
}

.assign-form {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.assign-form label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
    padding-top: 0.3rem;
}

.assign-form select {
    min-height: 5rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85rem;
}

.ticket-body {
    padding: 1rem 0;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.ticket-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 6px;
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.inline-form label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}

.inline-form select {
    padding: 0.3rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85rem;
}

/* === Comments === */
.comments-section h2 {
    font-size: 1.15rem;
    margin-bottom: 1rem;
}

.comment {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.comment-header strong {
    color: #1e293b;
}

.comment-date {
    font-size: 0.8rem;
    color: #94a3b8;
}

.comment-body {
    font-size: 0.9rem;
    line-height: 1.6;
}

.comment-form {
    margin-top: 1.5rem;
}

/* === Empty state === */
.empty-state {
    text-align: center;
    color: #94a3b8;
    padding: 3rem 1rem;
    font-size: 1rem;
}

/* === Footer === */
.footer {
    text-align: center;
    padding: 1.5rem 0;
    font-size: 0.8rem;
    color: #94a3b8;
    border-top: 1px solid #e2e8f0;
    margin-top: 2rem;
}

/* === Responsive === */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 0.75rem;
    }
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    .page-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    .table {
        display: block;
        overflow-x: auto;
    }
    .ticket-actions {
        flex-direction: column;
    }
}
