/* =============================================
   CEERI IT HELPDESK — RESPONSIVE STYLESHEET
   Supports: Desktop, Tablet, Mobile
   ============================================= */

/* ─── RESET & BASE ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background: #f5f7fb;
}

/* ─── TOPBAR ────────────────────────────────── */
.dashboard-topbar {
    background: #8b1e1e;
    height: 80px;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    gap: 12px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    min-width: 0;
}

.topbar-left img {
    height: 56px;
    width: auto;
    flex-shrink: 0;
}

.topbar-text h2 {
    color: white;
    margin: 0;
    font-size: 22px;
    font-weight: bold;
    white-space: nowrap;
}

.topbar-text p {
    color: #f1f1f1;
    margin: 0;
    font-size: 12px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.welcome-text {
    font-weight: bold;
    color: white;
    font-size: 14px;
    white-space: nowrap;
}

.dashboard-title {
    font-size: 20px;
    font-weight: bold;
    color: white;
}

/* ─── LOGOUT / ACTION BUTTONS ───────────────── */
.logout-btn {
    background: white;
    color: #8b1e1e;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 14px;
    white-space: nowrap;
    transition: 0.2s;
}
.logout-btn:hover { background: #f2f2f2; color: #8b1e1e; }

/* ─── MAIN LAYOUT ───────────────────────────── */
.dashboard-container {
    display: flex;
    min-height: calc(100vh - 80px);
}

/* ─── SIDEBAR ───────────────────────────────── */
.sidebar {
    width: 230px;
    flex-shrink: 0;
    background: linear-gradient(to bottom, #1d3557, #14213d);
    padding: 25px 0 20px;
}

.sidebar h3 {
    color: white;
    text-align: center;
    margin: 0 0 20px;
    font-size: 15px;
    letter-spacing: 1px;
    opacity: 0.7;
}

.sidebar a {
    display: block;
    color: white;
    text-decoration: none;
    padding: 13px 20px;
    margin: 4px 10px;
    border-radius: 10px;
    transition: 0.25s;
    font-weight: 500;
    font-size: 14px;
}

.sidebar a:hover,
.sidebar a.active-menu {
    background: #457b9d;
    transform: translateX(4px);
}

.sidebar i { margin-right: 8px; }

/* ─── HAMBURGER (mobile only) ───────────────── */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 26px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

/* ─── MAIN CONTENT ──────────────────────────── */
.main-content {
    flex: 1;
    padding: 25px;
    background: #f4f6f9;
    min-width: 0; /* prevent overflow */
    overflow-x: auto;
}

/* ─── DASHBOARD CARDS ───────────────────────── */
.dashboard-card {
    color: white;
    border-radius: 16px;
    padding: 22px 16px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: 0.3s;
    position: relative;
    overflow: hidden;
}
.dashboard-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}
.dashboard-card h1 {
    font-size: 42px;
    margin: 0 0 6px;
    font-weight: bold;
}
.dashboard-card p  { font-size: 16px; margin: 0; }
.dashboard-icon    { font-size: 40px; margin-bottom: 10px; opacity: 0.85; }

/* CARD COLOURS */
.blue-card   { background: linear-gradient(135deg, #0077b6, #00b4d8); }
.yellow-card { background: linear-gradient(135deg, #ffb703, #fb8500); }
.green-card  { background: linear-gradient(135deg, #2a9d8f, #52b788); }
.red-card    { background: linear-gradient(135deg, #d62828, #ef233c); }

/* ─── RECENT / CONTENT BOXES ────────────────── */
.recent-box {
    background: white;
    padding: 22px;
    border-radius: 18px;
    margin-top: 25px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    transition: 0.3s;
}
.recent-box:hover { box-shadow: 0 8px 20px rgba(0,0,0,0.1); }

/* ─── TABLES ────────────────────────────────── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table {
    width: 100%;
    background: white;
    border-collapse: collapse;
}
.table {
    width: 100%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}
table th, table td,
.table th, .table td {
    padding: 12px 14px;
    vertical-align: middle;
    text-align: center;
}
table th, .table th {
    background: #1d3557 !important;
    color: white;
}
table tr:hover, .table-hover tbody tr:hover { background: #f1f5f9; }

/* ─── FORM CONTROLS ─────────────────────────── */
.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 16px;
    color: black !important;
    background: white !important;
    box-sizing: border-box;
}
.form-control:focus { color: black !important; background: white !important; outline: none; border-color: #457b9d; }

input { color: black !important; }
input::placeholder { color: #666 !important; }

.table select { min-width: 140px; }

/* ─── PORTAL BUTTON ─────────────────────────── */
.portal-btn {
    background: #8b1e1e;
    color: white;
    border: none;
    padding: 9px 16px;
    border-radius: 8px;
    text-decoration: none;
    display: inline-block;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
}
.portal-btn:hover { background: #a83232; color: white; transform: translateY(-2px); }

.view-btn {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white !important;
    border: none;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
    transition: 0.2s;
    box-shadow: 0 3px 10px rgba(37,99,235,0.3);
}
.view-btn:hover { background: linear-gradient(135deg, #1d4ed8, #1e40af); transform: translateY(-2px); color: white !important; }

/* ─── STATUS BADGES ─────────────────────────── */
.status-pending   { background: #ffb703; color: white; padding: 5px 12px; border-radius: 20px; font-size: 13px; font-weight: bold; }
.status-progress  { background: #0077b6; color: white; padding: 5px 12px; border-radius: 20px; font-size: 13px; font-weight: bold; }
.status-completed { background: #2a9d8f; color: white; padding: 5px 12px; border-radius: 20px; font-size: 13px; font-weight: bold; }
.status-withdrawn { background: #888;    color: white; padding: 5px 12px; border-radius: 20px; font-size: 13px; font-weight: bold; }
.status-rejected  { background: #a52a2a; color: white; padding: 5px 12px; border-radius: 20px; font-size: 13px; font-weight: bold; }
.status-assigned  { background: #0077b6; color: white; padding: 5px 12px; border-radius: 20px; font-size: 13px; font-weight: bold; }

/* ─── PRIORITY BADGES ───────────────────────── */
.priority-low    { background: #2a9d8f; color: white; padding: 5px 12px; border-radius: 20px; font-size: 13px; }
.priority-medium { background: #ffb703; color: white; padding: 5px 12px; border-radius: 20px; font-size: 13px; }
.priority-high   { background: #fb8500; color: white; padding: 5px 12px; border-radius: 20px; font-size: 13px; }
.priority-urgent { background: #d62828; color: white; padding: 5px 12px; border-radius: 20px; font-size: 13px; }

/* ─── NOTIFICATION ──────────────────────────── */
.notification-area  { position: relative; display: inline-block; }
.notify-count {
    position: absolute; top: -8px; right: -8px;
    background: red; color: white;
    font-size: 11px; width: 18px; height: 18px;
    border-radius: 50%; display: flex;
    justify-content: center; align-items: center;
    font-weight: bold;
}
.notification-badge {
    background: red; color: white;
    padding: 5px 12px; border-radius: 50px;
    font-size: 13px; font-weight: bold;
}
.notification-bell {
    font-size: 20px; cursor: pointer;
    animation: ring 1.5s infinite;
}
@keyframes ring {
    0%,100% { transform: rotate(0); }
    25%,75%  { transform: rotate(10deg); }
    50%      { transform: rotate(-10deg); }
}

/* ─── PANEL DROPDOWN ────────────────────────── */
.panel-dropdown { position: relative; display: inline-block; }
.panel-btn {
    background: #ffffff; color: #222;
    border: none; padding: 8px 14px;
    border-radius: 8px; font-weight: 600; cursor: pointer;
}
.panel-dropdown-content {
    display: none; position: absolute; right: 0;
    background: #fff; min-width: 180px;
    border-radius: 10px; overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2); z-index: 999;
}
.panel-dropdown-content a {
    display: block; padding: 12px 15px;
    text-decoration: none; color: #222;
    font-size: 14px; border-bottom: 1px solid #eee;
}
.panel-dropdown-content a:hover { background: #f5f5f5; }
.panel-dropdown:hover .panel-dropdown-content { display: block; }

/* ─── INPUT ERROR ───────────────────────────── */
.input-error { border: 2px solid red !important; background-color: #fff8f8 !important; }
#email-error { color: red; font-size: 13px; font-weight: bold; display: none; margin-top: 5px; }

/* ─── TOP USER AREA ─────────────────────────── */
.top-user-area { display: flex; align-items: center; gap: 12px; }

/* ─── ROW / COL HELPERS ─────────────────────── */
.row  { margin: 0; }
.col-md-4 { margin-bottom: 20px; }

/* ================================================
   LOGIN PAGE
   ================================================ */
.login-body {
    margin: 0; padding: 0;
    font-family: Arial, sans-serif;
    background: linear-gradient(90deg, #081a3d 0%, #112d59 40%, #2d5f89 100%);
    min-height: 100vh;
}
.login-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px 16px;
    gap: 0;
}
.logo-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 12px 18px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.25);
    margin-bottom: -28px;
    z-index: 2;
}
.logo-card img { width: 110px; height: auto; display: block; }

.login-box {
    width: 100%;
    max-width: 440px;
    background: rgba(68,90,126,0.92);
    backdrop-filter: blur(10px);
    border-radius: 30px;
    padding: 55px 45px 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.35);
    color: white;
    z-index: 1;
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-header h1 { font-size: 42px; margin: 0; font-weight: bold; letter-spacing: 2px; }
.login-header p  { margin-top: 8px; color: #ddd; }

/* Inputs */
.input-group-custom {
    display: flex; align-items: center;
    background: rgba(120,140,170,0.45);
    padding: 16px 18px; border-radius: 16px; margin-bottom: 22px;
    border: 1px solid rgba(255,255,255,0.08); transition: border 0.2s;
}
.input-group-custom:focus-within { border-color: rgba(255,183,3,0.5); background: rgba(255,255,255,0.18); }
.input-group-custom i  { margin-right: 12px; font-size: 17px; color: rgba(255,255,255,0.6); }
.input-group-custom input {
    width: 100%; border: none; background: none;
    outline: none; color: white; font-size: 16px;
}
.input-group-custom input::placeholder { color: rgba(255,255,255,0.55); }

/* Login inside the box overrides */
.login-box input { color: white !important; }
.login-box input::placeholder { color: #e2e8f0 !important; }
.login-box a { color: #ffffff !important; font-weight: bold; }

/* Login button */
.login-btn {
    width: 100%; padding: 16px;
    border: none; border-radius: 14px;
    background: #f6b800; color: black;
    font-size: 18px; font-weight: bold;
    cursor: pointer; transition: 0.25s; margin-top: 4px;
}
.login-btn:hover { background: #e2a800; transform: translateY(-2px); }

/* Extra links */
.extra-links { display: flex; justify-content: space-between; margin-top: 18px; }
.extra-links a { color: white; text-decoration: none; font-size: 14px; }
.extra-links a:hover { text-decoration: underline; }

.forgot-link {
    display: block; text-align: center; margin-top: 16px;
    color: rgba(255,255,255,0.7); font-size: 14px;
    text-decoration: none; font-weight: 600;
}
.forgot-link:hover { color: #ffb703; }

.login-footer { text-align: center; margin-top: 22px; color: #ddd; font-size: 13px; }

/* Login alerts */
.login-alert { border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-size: 14px; text-align: center; }
.login-alert-success { background: rgba(212,237,218,0.2); color: #9effc0; border: 1px solid rgba(155,230,170,0.3); }
.login-alert-danger  { background: rgba(248,215,218,0.2); color: #ffc0c8; border: 1px solid rgba(230,155,160,0.3); }

/* ================================================
   TABLET  (≤ 992px)
   ================================================ */
@media (max-width: 992px) {
    .topbar-text h2 { font-size: 18px; }
    .sidebar { width: 200px; }
    .dashboard-card h1 { font-size: 34px; }
}

/* ================================================
   MOBILE  (≤ 768px)
   ================================================ */
@media (max-width: 768px) {

    /* TOPBAR */
    .dashboard-topbar {
        height: auto;
        padding: 10px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .topbar-left { flex: 1; min-width: 0; }
    .topbar-left img { height: 44px; }
    .topbar-text h2 { font-size: 15px; }
    .topbar-text p  { font-size: 11px; }

    /* Show hamburger, hide sidebar by default */
    .hamburger-btn { display: block; }

    .topbar-right {
        order: 3;
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        font-size: 13px;
    }
    .welcome-text { font-size: 13px; }
    .logout-btn   { padding: 7px 12px; font-size: 13px; }

    /* LAYOUT */
    .dashboard-container { flex-direction: column; }

    /* SIDEBAR — collapsible on mobile */
    .sidebar {
        width: 100%;
        min-height: auto;
        padding: 0;
        overflow: hidden;
        max-height: 0;
        transition: max-height 0.35s ease;
    }
    .sidebar.open { max-height: 600px; padding: 16px 0; }

    .sidebar h3 { margin-bottom: 10px; font-size: 13px; }
    .sidebar a  { padding: 11px 18px; margin: 3px 8px; font-size: 14px; }

    /* MAIN CONTENT */
    .main-content { padding: 14px; }

    /* CARDS */
    .dashboard-card { margin-bottom: 12px; padding: 18px 12px; }
    .dashboard-card h1 { font-size: 30px; }
    .dashboard-icon    { font-size: 32px; }

    /* TABLE — horizontal scroll */
    .table { min-width: 600px; }
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table  { min-width: 600px; }

    /* FORMS */
    .form-control { font-size: 15px; }
    .portal-btn, .login-btn { width: 100%; margin-top: 10px; text-align: center; }

    /* RECENT BOX */
    .recent-box { padding: 14px; margin-top: 16px; }

    /* LOGIN */
    .login-box  { padding: 50px 20px 32px; }
    .login-header h1 { font-size: 32px; }
    .logo-card img   { width: 90px; }
    .extra-links     { flex-direction: column; align-items: center; gap: 10px; }

    /* HEADINGS */
    h1, h2, h3 { font-size: clamp(18px, 5vw, 24px); }
}

/* ================================================
   SMALL MOBILE  (≤ 480px)
   ================================================ */
@media (max-width: 480px) {
    .topbar-text h2 { font-size: 13px; }
    .topbar-left img { height: 38px; }
    .dashboard-card h1 { font-size: 26px; }
    .sidebar a { font-size: 13px; }
    .login-header h1 { font-size: 28px; }
    .login-box { padding: 48px 16px 28px; }
}

/* ================================================
   TOPBAR MOBILE OVERFLOW FIX (patch)
   ================================================ */
@media (max-width: 768px) {
    /* Keep topbar in one line: logo | ☰ hamburger */
    .dashboard-topbar {
        flex-wrap: nowrap;
        padding: 8px 12px;
        gap: 8px;
        align-items: center;
    }

    /* Logo area shrinks but stays visible */
    .topbar-left {
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }
    .topbar-left img { height: 38px; }
    .topbar-text h2  { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .topbar-text p   { display: none; } /* hide subtitle on mobile */

    /* Hamburger always visible, right side of topbar */
    .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        font-size: 22px;
        flex-shrink: 0;
    }

    /* Hide the right-side buttons (welcome / change password / logout)
       — they move INTO the sidebar on mobile */
    .topbar-right { display: none !important; }

    /* Sidebar gets the logout links appended via CSS trick:
       we show them at the bottom of the open sidebar */
    .sidebar.open { padding-bottom: 20px; }
}

/* Sidebar mobile footer (logout shown only in sidebar on mobile) */
.sidebar-mobile-footer {
    display: none;
    border-top: 1px solid rgba(255,255,255,0.15);
    margin-top: 10px;
    padding-top: 6px;
}
.sidebar-mobile-footer a {
    display: block;
    color: #ffb703;
    text-decoration: none;
    padding: 12px 20px;
    margin: 4px 10px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 14px;
}
.sidebar-mobile-footer a:hover { background: #8b1e1e; }

@media (max-width: 768px) {
    .sidebar-mobile-footer { display: block; }
}

/* Expandable description cells in complaint tables - click to see
   the full text instead of it being cut off with "..." */
.desc-cell {
    max-width: 220px;
}
.desc-cell summary {
    cursor: pointer;
    color: #1a6bbf;
    list-style: none;
}
.desc-cell summary::-webkit-details-marker {
    display: none;
}
.desc-cell summary:hover {
    text-decoration: underline;
}
.desc-cell[open] summary {
    color: #888;
    font-size: .75rem;
}
.desc-cell[open] summary::after {
    content: " (show less)";
}
.desc-full {
    white-space: pre-wrap;
    word-break: break-word;
    margin-top: 4px;
}

/* Action buttons (Assign / Complete / Reject) - side by side on
   desktop, stacked on mobile so the table doesn't need horizontal
   scrolling just to reach them. */
.action-cell {
    white-space: nowrap;
}
.action-cell form,
.action-cell > button {
    display: inline-block;
    vertical-align: top;
}

@media (max-width: 768px) {
    .action-cell {
        white-space: normal;
        min-width: 90px;
    }
    .action-cell form,
    .action-cell > button {
        display: block;
        width: 100%;
        margin: 4px 0 !important;
    }
    .action-cell form button {
        width: 100%;
    }

    /* Reports filter bar - wrap instead of forcing horizontal scroll */
    .reports-filter-row {
        flex-wrap: wrap;
    }
    .reports-filter-row input[type="date"] {
        width: 100% !important;
        max-width: 160px;
    }
}

/* Key-value detail tables (View Complaint pages) - stack into
   label-above-value blocks on mobile instead of staying as a
   rigid 2-column table that forces horizontal scrolling. */
.detail-table th {
    width: 175px;
}
.detail-table td {
    word-break: break-word;
    overflow-wrap: break-word;
}
@media (max-width: 768px) {
    .detail-table, .detail-table tbody,
    .detail-table tr, .detail-table th, .detail-table td {
        display: block !important;
        width: 100% !important;
    }
    .detail-table tr {
        margin-bottom: 10px;
        padding-bottom: 6px;
        border-bottom: 1px solid #e5e5e5;
    }
    .detail-table th {
        border: none;
        padding: 8px 8px 2px;
        color: #1a3a5c;
        font-size: .8rem;
        text-transform: uppercase;
        letter-spacing: .3px;
    }
    .detail-table td {
        border: none;
        padding: 0 8px 4px;
    }
}

/* Dashboard stat cards as clickable filters */
.dashboard-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}
.dashboard-card-link .dashboard-card {
    cursor: pointer;
}
.dashboard-card-link .dashboard-card.active-filter {
    outline: 3px solid #fff;
    outline-offset: -3px;
    box-shadow: 0 0 0 4px rgba(0,0,0,0.18), 0 8px 25px rgba(0,0,0,0.25);
}
.filter-banner {
    background: #eef3fb;
    border: 1px solid #c9d6ec;
    border-radius: 10px;
    padding: 10px 16px;
    margin-bottom: 14px;
    font-size: 14px;
    color: #1a3a5c;
}
.filter-banner a {
    color: #8b1e1e;
    font-weight: bold;
    text-decoration: none;
    margin-left: 10px;
}
.filter-banner a:hover { text-decoration: underline; }
