/* === MODERN HELPDESK UI REVAMP === */

/* --- 1. Variables & Global Resets --- */
:root {
    --primary-color: #4f46e5;
    /* A modern indigo */
    --primary-hover: #4338ca;
    --secondary-color: #6b7280;
    /* Cool Gray */
    --success-color: #10b981;
    /* Emerald */
    --danger-color: #ef4444;
    /* Red */
    --warning-color: #f59e0b;
    /* Amber */
    --info-color: #3b82f6;
    /* Blue */
    --light-gray: #f3f4f6;
    --medium-gray: #e5e7eb;
    --dark-gray: #374151;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --white: #ffffff;
    --border-color: #d1d5db;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --border-radius: 0.375rem;
    /* 6px */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--light-gray);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* --- THE DEFINITIVE STICKY FOOTER --- */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- 2. Main Layout & Structure --- */
.page-wrapper {
    display: flex;
    flex: 1 0 auto;
    /* This is the key: flex-grow: 1, flex-shrink: 0, flex-basis: auto */
}

.non-admin-wrapper {
    /* Add this selector if it's missing */
    flex: 1 0 auto;
}

.sidebar {
    width: 260px;
    background: var(--dark-gray);
    color: var(--white);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    /* min-height: 100vh; REMOVE THIS LINE */
}

.main-content {
    flex-grow: 1;
    padding: 2rem;
    max-width: calc(100% - 260px);
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    margin: 0;
    font-size: 1.875rem;
}

/* --- 3. Navigation (Top Bar for Users, Sidebar for Admins) --- */
.top-nav {
    background: var(--white);
    padding: 0 2rem;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    height: 64px;
}

.top-nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: 1280px;
    margin: 0 auto;
}

.top-nav-links,
.top-nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.top-nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    padding: 0.5rem;
}

.top-nav-links a:hover {
    color: var(--primary-color);
}

.sidebar-header {
    padding: 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: #d1d5db;
    text-decoration: none;
    transition: all 0.2s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: var(--primary-color);
    color: var(--white);
}

.sidebar-nav a .fa-fw {
    width: 1.25em;
}

/* Fixed width icons */

/* --- 4. Cards & Panels --- */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.ticket-details-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
}

/* --- 5. Forms & Buttons --- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    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-color);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.3);
}

.ck-editor__editable_inline {
    min-height: 150px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-primary {
    color: var(--white);
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    color: var(--dark-gray);
    background-color: var(--white);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--light-gray);
}

/* --- 6. Tables --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: middle;
}

.data-table thead th {
    background-color: var(--light-gray);
    font-weight: 600;
    color: var(--text-light);
}

.data-table tbody tr:hover {
    background-color: #f9fafb;
}

/* --- 7. Specific Components --- */
/* Status Badges */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-open {
    background-color: #dbeafe;
    color: #1e40af;
}

.status-in-progress {
    background-color: #cffafe;
    color: #0e7490;
}

.status-on-hold {
    background-color: #fef3c7;
    color: #92400e;
}

.status-resolved {
    background-color: #d1fae5;
    color: #065f46;
}

.status-closed {
    background-color: #e5e7eb;
    color: #4b5563;
}

/* Flash Messages */
.message {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-left-width: 4px;
    border-radius: var(--border-radius);
}

.message-success {
    background-color: #f0fdf4;
    border-color: var(--success-color);
    color: #14532d;
}

.message-error {
    background-color: #fef2f2;
    border-color: var(--danger-color);
    color: #991b1b;
}

/* Dashboard Stat Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.stat-card h3 {
    margin-top: 0;
    color: var(--text-light);
}

.stat-card .stat-number {
    font-size: 2.25rem;
    font-weight: 700;
    margin: 0;
}

/* Ticket Comments */
.comment {
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 0;
}

.comment:last-child {
    border-bottom: none;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.comment-body {
    color: var(--dark-gray);
}

.comment-body p:first-child {
    margin-top: 0;
}

.comment-body p:last-child {
    margin-bottom: 0;
}

/* --- 8. Footer --- */
.main-footer {
    padding: 1.5rem 2rem;
    text-align: center;
    font-size: 0.875rem;
    /* 14px */
    color: var(--text-light);
    border-top: 1px solid var(--border-color);
    margin-top: 0rem;
    /*was 2rem*/
    background-color: var(--white);
}

/* --- 9. Search Bar --- */
.search-bar {
    margin-bottom: 1.5rem;
}

.search-form {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-form .form-group {
    flex-grow: 1;
    /* Make the search input take up available space */
    margin-bottom: 0;
}