:root {
    /* Base Colors - Alter Pharma Brand */
    --bg-light: #f4f7f6;
    --bg-white: #ffffff;
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --border: #edf2f1;
    
    /* Brand Colors */
    --primary: #00aeb7; /* Teal */
    --primary-hover: #008f96;
    --accent: #f26d6d; /* Coral */
    --accent-hover: #d95a5a;
    
    /* Ticket Status Colors - Adjusted for light theme */
    --status-completed: #10b981;
    --status-completed-bg: #ecfdf5;
    
    --status-progress: #f97316;
    --status-progress-bg: #fff7ed;
    
    --status-pending: #eab308;
    --status-pending-bg: #fefce8;

    /* UI Measurements */
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.2s ease-in-out;
}

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

body {
    background-color: var(--bg-light);
    color: var(--text-main);
    font-family: var(--font-family);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Updated Panel Style */
.glass-panel {
    background: var(--bg-white);
    border: 1px solid var(--border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

/* --- Login Screen --- */
.login-bg {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #f4f7f6 0%, #ffffff 100%);
}

.brand-logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

.brand-text-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
}

.brand-main {
    font-size: 20px;
    font-weight: 700;
    color: #455a64;
    letter-spacing: 1px;
}

.brand-sub {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 2px;
    margin-top: -4px;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    border-radius: var(--radius-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h2 { font-size: 22px; font-weight: 700; margin-bottom: 8px; color: var(--primary); }

.demo-hints {
    margin: 24px 0;
    padding: 16px;
    background: #fdf2f2;
    border: 1px solid #f8d7da;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: #842029;
}
.demo-hints code { color: #000; background: rgba(0,0,0,0.05); padding: 2px 4px; border-radius: 4px; }

/* --- Forms & Inputs --- */
.input-modern {
    width: 100%;
    background: #fcfcfc;
    border: 1px solid #d1d5db;
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
}

.input-modern:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 174, 183, 0.15);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px; /* Increased padding */
    font-weight: 600;
    border-radius: 50px; /* Fully rounded */
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }

.btn-secondary { 
    background: #f8fafc; 
    color: var(--text-main); 
    border: 1px solid var(--border); 
}
.btn-secondary:hover { background: #f1f5f9; }

.btn-login {
    display: flex;
    margin: 30px auto 10px;
    padding: 14px 40px; 
    font-size: 16px;
    font-weight: 700;
    width: auto;
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(0, 174, 183, 0.2);
}

/* --- Dashboard Layout --- */
.layout { 
    display: flex !important; 
    height: 100vh;
    width: 100%;
}

.sidebar {
    width: 260px;
    height: 100vh;
    display: flex !important;
    flex-direction: column;
    padding: 24px 16px;
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar .brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 8px 32px 8px;
}
.sidebar .brand h1 { font-size: 18px; font-weight: 600; color: var(--primary); }

.nav-menu { flex: 1; display: flex; flex-direction: column; gap: 4px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: var(--transition);
}

.nav-item:hover { color: var(--primary); background: rgba(0, 174, 183, 0.05); }

.nav-item.active { 
    background: rgba(0, 174, 183, 0.1); 
    color: var(--primary); 
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.sidebar-footer button {
    color: var(--primary);
    font-weight: 700;
    border: 1px solid #d1d5db !important; /* Subtle grey */
    box-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: hidden; /* Prevent body scroll */
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 40px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.top-bar h2 { font-size: 20px; font-weight: 600; }

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

.content-area { 
    padding: 40px; 
    flex: 1; 
    overflow-y: auto; 
}
.section-hidden { display: none !important; }

/* --- Tickets List --- */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}
.section-header h3 { font-size: 24px; margin-bottom: 4px; }
.subtitle { color: var(--text-muted); font-size: 14px; }

.controls-bar { margin-bottom: 24px; display: flex; gap: 16px; }
.controls-bar select { max-width: 250px; }

.tickets-container { display: flex; flex-direction: column; gap: 16px; }

.ticket-card {
    background: var(--bg-white);
    padding: 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative; /* For ribbon */
    overflow: hidden; /* Clamp ribbon */
}
.ticket-card:hover { transform: translateY(-2px); border-color: var(--primary); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }

.ticket-info h4 { font-size: 16px; margin-bottom: 6px; color: var(--primary); }
.ticket-info p { color: var(--text-muted); font-size: 13px; margin-bottom: 8px; }

.ticket-meta { display: flex; gap: 16px; font-size: 12px; color: var(--text-muted); }

/* Unread Ribbon */
.unread-ribbon {
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 40px 40px 0;
    border-color: transparent var(--accent) transparent transparent;
    z-index: 1;
}

.unread-ribbon::after {
    content: "!";
    position: absolute;
    top: 5px;
    right: -35px;
    color: white;
    font-size: 10px;
    font-weight: 900;
}

/* Status Badges */
.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.status-completed { color: var(--status-completed); background: var(--status-completed-bg); border: 1px solid rgba(16, 185, 129, 0.3); }
.status-progress  { color: var(--status-progress); background: var(--status-progress-bg); border: 1px solid rgba(249, 115, 22, 0.3); }
.status-pending   { color: var(--status-pending); background: var(--status-pending-bg); border: 1px solid rgba(234, 179, 8, 0.3); }

/* --- Modals and Comments --- */
.overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(44, 62, 80, 0.4); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center; z-index: 2000;
}

.modal-content {
    background: var(--bg-white);
    width: 90%; max-width: 500px; padding: 32px; border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}
.modal-large { max-width: 800px; height: 90vh; display: flex; flex-direction: column; }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-header h3 { font-size: 20px; margin-bottom: 8px; color: var(--primary); }

.close-btn { background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; }
.close-btn:hover { color: var(--accent); }

.ticket-details { flex: 1; display: flex; flex-direction: column; overflow: hidden; gap: 24px; }

.modal-body .ticket-info { background: #f8fafc; padding: 20px; border-radius: var(--radius-md); border: 1px solid var(--border); }
.desc-text { color: var(--text-main); font-size: 14px; line-height: 1.6; margin-top: 8px; margin-bottom: 16px; }

.status-manager { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.status-select { font-weight: 600; padding: 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* Comments */
.comments-section { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.comments-section h4 { margin-bottom: 16px; font-size: 16px; color: var(--primary); }

.comments-list {
    flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 16px;
    padding-right: 8px; margin-bottom: 16px;
}

.comment {
    background: #f8fafc; padding: 16px; border-radius: var(--radius-md);
    border: 1px solid var(--border);
}
.comment-header { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; }
.comment-author { font-weight: 600; color: var(--primary); }
.comment.tech .comment-author { color: var(--accent); }
.comment-date { color: var(--text-muted); }
.comment-text { font-size: 14px; line-height: 1.5; color: var(--text-main); }
.comment-image { margin-top: 12px; max-width: 100%; border-radius: 8px; border: 1px solid rgba(255,255,255,0.1); cursor: pointer; }

.comment-input-area { display: flex; gap: 12px; }

/* Image Preview before upload */
.image-preview-container { 
    margin-top: 12px; 
    position: relative; 
    display: inline-block;
}
.image-preview-container img {
    height: 60px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--primary);
}
.remove-img {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    font-weight: bold;
}

/* --- Stats View --- */
.stats-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
@media (max-width: 1024px) { .stats-grid { grid-template-columns: 1fr; } }

.chart-card { padding: 24px; border-radius: var(--radius-lg); }
.chart-card h4 { margin-bottom: 24px; font-size: 16px; color: var(--text-muted); font-weight: 500;}
.chart-container { position: relative; height: 300px; width: 100%; }

/* Utilities */
.hidden { display: none !important; }
/* --- User Management Table --- */
.user-table th {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-table td {
    font-size: 14px;
    color: var(--text-main);
}

.user-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .layout {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 16px;
        position: sticky;
        top: 0;
        z-index: 1000;
    }

    .sidebar .brand {
        padding-bottom: 16px;
    }

    .nav-menu {
        flex-direction: row;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 8px;
    }

    .nav-item {
        padding: 8px 12px;
        font-size: 13px;
        white-space: nowrap;
    }

    .sidebar-footer {
        display: flex;
        justify-content: center;
        width: 100%;
        margin-top: 10px;
        padding-top: 8px;
        border-top: none;
    }

    .sidebar-footer .btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .main-content {
        height: auto;
        overflow-y: visible;
    }

    .top-bar {
        padding: 12px 20px;
    }

    .top-bar h2 {
        font-size: 16px;
    }

    .content-area {
        padding: 20px;
    }

    .section-header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }

    .section-header .btn {
        width: 100%;
    }

    .controls-bar {
        flex-direction: column;
    }

    .controls-bar select {
        max-width: 100%;
    }

    .ticket-card {
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .status-badge {
        width: 100%;
        text-align: center;
    }

    /* Modal Adjustments */
    .modal-content {
        width: 95%;
        padding: 20px;
    }

    .modal-large {
        height: 95vh;
    }

    .comments-section h4 {
        font-size: 14px;
    }

    .comment-input-area {
        flex-direction: column;
    }
}

/* Specific small phones adjustment */
@media (max-width: 480px) {
    .login-container {
        padding: 30px 20px;
        margin: auto;
        width: 100%;
        max-width: 100%;
    }
    
    .login-header h2 {
        font-size: 20px;
    }
    
    .btn-login {
        width: 100%;
        min-width: unset;
    }

    .user-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}
