:root {
    --primary: #234C6A;
    --primary-dark: #1C3D54;
    --bg: #E3E3E3;
    --surface: #F4F4F4;
    --white: #FFFFFF;
    --accent: #FF8686;
    --green-light: rgba(135, 255, 153, 0.6);
    --glass: rgba(255, 255, 255, 0.6);
    --shadow-card: 0px 8px 20px 0px rgba(0, 0, 0, 0.25);
    --shadow-header: 0px 11px 22px 0px rgba(0, 0, 0, 0.25);

    --font-poppins: 'Poppins', sans-serif;
}

.bold-title {
    font-weight: 700;
}

.regular-title {
    font-weight: 400;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg);
    font-family: var(--font-poppins);
    color: var(--primary);
    min-height: 100vh;
    padding-bottom: 1rem;
    overflow-x: hidden;
}

/* Hide scrollbar but keep scroll functionality */
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.text-center {
    text-align: center;
}

/* --- Header --- */
.header {
    position: relative;
    width: 100%;
    height: 100px;
    margin-bottom: 2rem;
}

.header-bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--surface);
    border-bottom-right-radius: 111px;
    box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

.header-content-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 84%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-dark) 0%, var(--primary) 100%);
    border-bottom-right-radius: 111px;
    box-shadow: var(--shadow-header);
    z-index: 2;
    display: flex;
    align-items: center;
    padding-left: 4rem;
}

.logo-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.logo-section .logo-icon {
    position: absolute;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--white);
    font-size: 2rem;
}

.logo-text h1 {
    font-family: var(--font-poppins);
    font-weight: 700;
    font-size: 32px;
    color: var(--bg);
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 28px;
}

.logo-text p {
    font-family: var(--font-poppins);
    font-weight: 400;
    font-size: 17px;
    color: var(--bg);
    margin-left: 0;
}

.header-clock {
    position: absolute;
    top: 0;
    right: 0;
    width: 16%;
    height: 100%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-right: 2rem;
}

.header-clock span {
    font-family: var(--font-poppins);
    font-weight: 400;
    font-size: 32px;
    color: var(--primary);
}

/* --- Layout --- */
.main-container {
    width: 100%;
    padding: 0 2rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    align-items: flex-start;
}


.left-column {
    flex: 0 0 32%;
    /* Take up ~32% of available space */
    min-width: 320px;
    max-width: 450px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.right-column {
    flex: 1 1 65%;
    /* Take up the remaining space dynamically */
    min-width: 0;
    /* Prevent flex box blowing out */
    display: flex;
    flex-direction: column;
    gap: 1.7rem;
}

/* --- Cards General --- */
.card {
    border-radius: 15px;
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(4px);
}

/* --- Stats Grid --- */
/* --- Stats Grid Fix --- */
/* Container Utama Grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    width: 100%;
    /* Fluid width instead of hardcoded 418px */
}

/* Card Base */
.stat-card {
    height: 110px;
    padding: 0;
    /* Padding dihilangkan agar card-inner bisa mengontrol ruang */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.card-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Sisi Kiri (Label) */
.label-side {
    flex: 1;
    /* Mengambil 50% ruang */
    display: flex;
    justify-content: center;
    /* Center horizontal */
    align-items: center;
    /* Center vertikal */
    text-align: center;
    padding: 0 5px;
}

.label-text {
    font-weight: 700;
    line-height: 1.1;
    font-size: 16px;
    text-transform: capitalize;
}

/* Garis Tengah yang Presisi */
.vertical-divider {
    width: 1.5px;
    height: 70%;
    /* Tinggi garis 70% dari tinggi card agar tidak mentok */
    background-color: currentColor;
    /* Mengikuti warna teks card */
    opacity: 0.3;
    flex-shrink: 0;
}

/* Sisi Kanan (Value) */
.value-side {
    flex: 1;
    /* Mengambil 50% ruang */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Blue Card */
.blue-card {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: var(--white);
}

.blue-card .value {
    font-size: 52px;
    /* Angka lebih besar seperti di gambar */
    font-weight: 800;
}

/* White Card */
.white-card {
    background: var(--white);
    color: var(--primary);
}

.white-card .value {
    font-size: 34px;
    font-weight: 800;
}

.white-card .value-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

.white-card .sub-value {
    font-size: 16px;
    color: var(--accent);
    font-weight: 700;
    margin-top: 4px;
}

/* Hover Effect */
.stat-card:hover {
    transform: translateY(-3px);
    transition: all 0.3s ease;
}

.stat-card h3 {
    text-align: center;
    font-weight: 700;
    line-height: 1.2;
    white-space: pre-line;
    margin-bottom: 0.5rem;
}

.stat-card .divider {
    height: 1px;
    width: 75%;
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-weight: 700;
}

/* Blue Variant */
.blue-card {
    background: linear-gradient(90deg, var(--primary-dark) 0%, var(--primary) 100%);

    color: var(--bg);
}

.blue-card h3 {
    font-size: 24px;
}

.blue-card .divider {
    background-color: var(--bg);
}

.blue-card .value {
    font-size: 48px;
}

/* White Variant */
.white-card {
    background: var(--glass);
    color: var(--primary);
}

.white-card h3 {
    font-size: 28px;
}

.white-card .divider {
    background-color: var(--primary);
}




/* --- Sidebar Menu --- */
.sidebar-menu {
    width: 100%;
    /* Fluid width instead of 418px */
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.menu-item {
    background: var(--glass);
    width: 100%;
    overflow: hidden;
    transition: all 0.3s ease;
    border-radius: 15px;
}

/* Collapsed = seperti Open Ticket sekarang */
.menu-item.collapsed {
    height: 93px;
}

/* Expanded = seperti Piket Schedule */
.menu-item.expanded {
    height: auto;
    min-height: 156px;
}

.menu-item.collapsed .menu-header {
    height: 93px;
    align-items: center;
}

.menu-item.expanded .menu-header {
    padding-top: 0.7rem;
    height: auto;
}

.menu-header {
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    cursor: pointer;
}

.menu-item.expanded .menu-header {
    height: auto;
    padding-bottom: 0.3rem;
}

.menu-title {
    font-weight: 700;
    font-size: 20px;
    color: var(--primary);
    flex: 1;
}

.menu-header i {
    font-size: 24px;
    color: var(--primary);
}

.menu-content {
    padding: 0 1.5rem 0.75rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Piket Schedule Specifics */
.shift-info-bar {
    display: flex;
    height: 29px;
    border-radius: 5px;
    overflow: hidden;
}

.shift-status {
    background-color: var(--primary);
    color: var(--bg);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.5rem;
    font-size: 14px;
    min-width: 100px;
}

.shift-time {
    background-color: var(--primary);
    color: var(--bg);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 0.75rem;
    font-size: 14px;
    white-space: nowrap;
}

.personnel-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.personnel-badge {
    background-color: var(--green-light);
    border-radius: 6px;
    text-align: center;
    padding: 4px 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

/* --- Ticket Table --- */
.table-card {
    height: 378px;
    background: var(--glass);
    padding: 0.5rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
    text-align: center;
}

.table-wrapper {
    flex: 1;
    background: var(--white);
    border: 1px solid #CCCCCC;
    border-radius: 10px;
    padding: 2px;
    overflow: auto;
}

.table-wrapper thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}


table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background-color: var(--primary);
    color: var(--white);
    padding: 8px 10px;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    border-right: 1px solid rgba(204, 204, 204, 0.3);
}

thead th:first-child {
    border-top-left-radius: 4px;
}

thead th:last-child {
    border-top-right-radius: 4px;
    border-right: none;
}

/* Pagination Styling for Laravel Bootstrap 5 */
.pagination-wrapper nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
}

.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    margin-bottom: 0;
    gap: 4px;
}

.page-item .page-link {
    position: relative;
    display: block;
    padding: 0.375rem 0.75rem;
    font-size: 14px;
    color: var(--primary);
    background-color: var(--white);
    border: 1px solid #CCC;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s;
}

.page-item.active .page-link {
    z-index: 3;
    color: var(--white);
    background-color: var(--primary);
    border-color: var(--primary);
}

.page-item.disabled .page-link {
    color: #999;
    pointer-events: none;
    background-color: #F8F9FA;
    border-color: #CCC;
}

.page-item .page-link:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
}

tbody tr {
    border-bottom: 1px solid #CCCCCC;
}

tbody tr:last-child {
    border-bottom: none;
}

tbody td {
    padding: 5px 10px;
    color: var(--primary);
    font-size: 15px;
    border-right: 1px solid #CCCCCC;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

tbody td:last-child {
    border-right: none;
}


/* --- Chat Widget --- */
.chat-card {
    height: 378px;
    background: var(--glass);
    padding: 0.5rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
}

.chat-area {
    border-radius: 10px;
    flex: 1;
    background-color: var(--bg);
    overflow-y: auto;
    margin-bottom: 1rem;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.date-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.date-divider .line {
    flex: 1;
    height: 1px;
    background-color: rgba(35, 76, 106, 0.2);
}

.date-divider span {
    font-size: 12px;
    color: rgba(35, 76, 106, 0.5);
}

.message-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 90%;
}

.sender-name {
    font-size: 12px;
    color: var(--primary);
}

.message-bubble {
    padding: 1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    font-size: 14px;
    line-height: 1.5;
}

/* Admin Specifics */
.message-group.admin {
    align-self: flex-end;
    align-items: flex-end;
}

.message-group.admin .sender-name {
    margin-right: 4px;
}

.message-group.admin .message-bubble {
    background-color: var(--primary);
    color: var(--bg);
    border-radius: 15px 15px 3px 15px;
}

/* Client Specifics */
.message-group.client {
    align-self: flex-start;
    align-items: flex-start;
}

.message-group.client .sender-name {
    margin-left: 4px;
}

.message-group.client .message-bubble {
    background-color: var(--white);
    color: var(--primary);
    border: 1px solid #F4F4F4;
    border-radius: 15px 15px 15px 3px;
}

.chat-input-area {
    position: relative;
    width: 100%;
}

.chat-input-area input {
    width: 100%;
    background-color: var(--bg);
    border: none;
    border-radius: 15px;
    padding: 12px 50px 12px 20px;
    color: var(--primary);
    font-family: var(--font-poppins);
    outline: none;
}

.chat-input-area input::placeholder {
    color: rgba(35, 76, 106, 0.6);
}

.send-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Footer --- */
.footer {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
}

.footer-content {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.footer-content .line {
    flex: 1;
    height: 1px;
    background-color: var(--primary);
}

.footer-content p {
    white-space: nowrap;
    font-size: 16px;
    color: var(--primary);
}

/* --- Responsive --- */
@media (max-width: 1100px) {
    .main-container {
        flex-direction: column;
        align-items: center;
        padding: 0 1rem;
    }

    .left-column,
    .right-column {
        width: 100%;
        max-width: 100%;
        align-items: stretch;
    }

    .stats-grid {
        justify-content: center;
    }

    .table-wrapper {
        overflow-x: auto;
    }

    .header-content-layer {
        width: 100%;
        border-radius: 0 0 50px 50px;
        padding-left: 2rem;
    }

    .header-bg-layer {
        border-radius: 0 0 50px 50px;
    }

    .header-clock {
        position: relative;
        width: 100%;
        height: 50px;
        background: var(--surface);
        justify-content: center;
        padding: 0;
    }

    .header {
        height: auto;
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
        width: auto;
    }

    .table-wrapper {
        overflow-x: auto;
    }
}

.ticket-content {
    padding: 0 1.5rem 1rem;
}

.ticket-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ticket-group {
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding-bottom: 5px;
}

.ticket-row {
    height: auto;
    /* Allow height to adjust but maintain minimum for alignment */
    min-height: 27px;
    background: rgba(217, 217, 217, 0.6);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 10px;
}

.ticket-row span {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    /* Biarkan span mengambil sisa ruang agar link tetap di ujung */
    margin-right: 10px;
}

.ticket-row a {
    font-size: 16px;
    font-weight: 400;
    color: var(--primary);
    text-decoration: none;
}

.ticket-row a:hover {
    text-decoration: underline;
}

.arrow-icon {
    font-size: 20px;
    color: var(--primary);
    transition: transform 0.3s ease;
}

/* rotate when expanded */
.menu-item.expanded .arrow-icon {
    transform: rotate(90deg);
}

/* 1. Overlay Modal */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    /* Background gelap transparan */
    z-index: 9999;
    display: none;
    /* Diatur jadi 'flex' via JavaScript */
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    /* Efek blur kekinian */
}

/* 2. Kotak Putih Modal */
.modal-content {
    background: #fff;
    width: 90%;
    max-width: 800px;
    padding: 25px;
    border-radius: 15px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 3. Tombol Close */
.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: 0.2s;
}

.close-modal:hover {
    color: #ff4d4d;
}

/* 4. Header & Detail (Kode Anda yang sudah difix) */
.modal-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
    text-transform: uppercase;
    margin: 0;
}

.modal-detail-wrapper {
    display: flex;
    gap: 20px;
    min-height: 250px;
}

.detail-info-list {
    flex: 1;
}

.detail-row {
    display: flex;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #444;
}

.detail-row span:first-child {
    width: 130px;
    font-weight: 600;
    color: #2c3e50;
    flex-shrink: 0;
}

/* 5. Map */
.map-container-small {
    width: 250px;
    /* Sedikit lebih lebar agar jelas */
    height: 180px;
    align-self: flex-end;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #ddd;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#map {
    width: 100%;
    height: 100%;
}

/* Responsif HP */
@media (max-width: 600px) {
    .modal-detail-wrapper {
        flex-direction: column;
    }

    .map-container-small {
        width: 100%;
        height: 200px;
        margin-top: 10px;
    }
}