/* LCKH - MIN 2 Kota Makassar */

:root {
    --primary: #1a5f4a;
    --primary-dark: #134a3a;
    --sidebar-width: 260px;
}

body {
    min-height: 100vh;
    background-color: #f4f6f9;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body:not(.app-body) {
    display: flex;
    flex-direction: column;
}

body:not(.app-body) main {
    flex: 1;
}

/* Sidebar layout */
.app-body {
    overflow-x: hidden;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.app-sidebar,
#appSidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    width: var(--sidebar-width);
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #134a3a;
    background: linear-gradient(180deg, #134a3a 0%, #1a5f4a 100%);
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: #fff;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.12);
    transition: transform 0.25s ease;
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    color: #fff;
    text-decoration: none;
}

.sidebar-brand-link > * + * {
    margin-left: 0.75rem;
}

.sidebar-brand-link:hover {
    color: #fff;
    text-decoration: none;
}

.sidebar-brand {
    padding: 1rem 1rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}

.sidebar-brand-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    padding: 2px;
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    font-size: 1.1rem;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}

.sidebar-brand-text strong {
    font-size: 1.05rem;
    letter-spacing: 0.5px;
}

.sidebar-brand-text small {
    font-size: 0.68rem;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0.5rem 1rem;
}

.sidebar-link,
.sidebar-group-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.55rem 0.75rem;
    margin-bottom: 2px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.9rem;
    text-align: left;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover,
.sidebar-group-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    text-decoration: none;
}

.sidebar-link.active,
.sidebar-group-toggle.active {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-weight: 600;
}

.sidebar-icon {
    width: 20px;
    margin-right: 0.65rem;
    text-align: center;
    opacity: 0.95;
    flex-shrink: 0;
}

.sidebar-label {
    flex: 1;
    text-align: left;
}

.sidebar-chevron {
    font-size: 0.7rem;
    opacity: 0.7;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.sidebar-group.is-open .sidebar-chevron {
    transform: rotate(180deg);
}

.sidebar-submenu {
    display: none;
    padding-left: 0.35rem;
    margin-bottom: 0.35rem;
}

.sidebar-group.is-open > .sidebar-submenu {
    display: block;
}

.sidebar-sublink {
    display: flex;
    align-items: center;
    padding: 0.45rem 0.75rem 0.45rem 2.35rem;
    margin-bottom: 1px;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.85rem;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.sidebar-sublink:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    text-decoration: none;
}

.sidebar-sublink.active {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-weight: 600;
}

.sidebar-sublink.text-danger {
    color: #ffb4b4 !important;
}

.sidebar-sublink.text-danger:hover {
    color: #fff !important;
    background: rgba(220, 53, 69, 0.35);
}

.sidebar-subicon {
    width: 16px;
    margin-right: 0.5rem;
    font-size: 0.75rem;
    opacity: 0.85;
}

.sidebar-user {
    padding: 0.85rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.72rem;
    opacity: 0.8;
}

.app-main {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 56px;
    padding: 0.5rem 1.25rem;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.sidebar-toggle {
    color: var(--primary);
    padding: 0.25rem 0.5rem;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus {
    color: var(--primary-dark);
    text-decoration: none;
    box-shadow: none;
}

.app-topbar-user {
    display: inline-flex;
    align-items: center;
    color: #495057;
    text-decoration: none;
    font-size: 0.9rem;
}

.app-topbar-user > * + * {
    margin-left: 0.4rem;
}

.app-topbar-user:hover {
    color: var(--primary);
    text-decoration: none;
}

.app-content {
    flex: 1;
    padding: 1.25rem;
}

.app-footer {
    padding: 0.75rem 1.25rem;
    background: #fff;
    border-top: 1px solid #e9ecef;
    text-align: center;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1035;
    background: rgba(0, 0, 0, 0.45);
}

.app-sidebar .sidebar-group-toggle {
    appearance: none;
    -webkit-appearance: none;
    box-shadow: none;
    outline: none;
    cursor: pointer;
}

.app-sidebar .sidebar-group-toggle:focus {
    outline: none;
    box-shadow: none;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.is-open {
        transform: translateX(0);
    }

    .sidebar-backdrop.is-visible {
        display: block;
    }

    .app-main {
        margin-left: 0;
    }

    .app-content {
        padding: 1rem;
    }
}

.navbar.bg-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
}

.navbar-logo {
    max-height: 32px;
    width: auto;
    object-fit: contain;
}

.login-logo {
    max-width: 100%;
    object-fit: contain;
}

.login-wrapper {
    background: linear-gradient(135deg, #e8f5f0 0%, #f4f6f9 50%, #dceee8 100%);
    min-height: 100vh;
}

.login-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    background: #e8f5f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-header h2 {
    font-weight: 700;
    color: #2c3e50;
}

.stat-card {
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background-color: var(--primary);
    border-color: var(--primary);
}

.text-primary {
    color: var(--primary) !important;
}

.card {
    border-radius: 10px;
}

.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
}

.badge {
    font-weight: 500;
    padding: 0.4em 0.7em;
}

.footer {
    margin-top: auto;
}

@media (max-width: 768px) {
    .page-header h2 {
        font-size: 1.5rem;
    }
}

.lampiran-thumb {
    max-height: 140px;
    object-fit: cover;
    width: 100%;
}

.lampiran-item {
    background: #fafbfc;
}

.signature-canvas {
    width: 100%;
    height: 150px;
    cursor: crosshair;
    display: block;
}

.signature-wrapper {
    touch-action: none;
}

.table-laporan-bulan {
    font-size: 0.85rem;
}

.table-laporan-bulan .table-group-day td {
    border-top: 2px solid #1a5f4a;
    padding: 0.5rem 0.75rem;
}

.lampiran-mini {
    width: 36px;
    height: 36px;
    object-fit: cover;
    vertical-align: middle;
}

.lampiran-inline a {
    text-decoration: none;
}

.btn-jempol {
    border-radius: 50%;
    width: 36px;
    height: 36px;
    padding: 0;
    line-height: 34px;
    border: 2px solid #dee2e6;
    color: #6c757d;
    background: #fff;
}

.btn-jempol:hover {
    border-color: #f0b429;
    color: #d99a00;
}

.btn-jempol.aktif {
    background: #ffca28;
    border-color: #e6a817;
    color: #5c4200;
    box-shadow: 0 2px 6px rgba(240, 180, 41, 0.45);
}

.jempol-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff3cd;
    color: #d99a00;
    font-size: 1.1rem;
}

.jempol-display .jempol-icon {
    font-size: 0.95rem;
    margin-right: 2px;
}

.jempol-display .jempol-img {
    width: 18px;
    height: 18px;
    margin-right: 2px;
    vertical-align: middle;
    display: inline-block;
}

.jempol-pick-btn .jempol-pick-icon {
    width: 18px;
    height: 18px;
    display: block;
    margin: 0 auto;
    opacity: 0.35;
    filter: grayscale(0.2);
}

.jempol-pick-btn:hover .jempol-pick-icon,
.jempol-pick-btn.aktif .jempol-pick-icon {
    opacity: 1;
    filter: none;
}

.jempol-picker-icons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.jempol-pick-btn {
    border: 2px solid #dee2e6;
    background: #fff;
    color: #adb5bd;
    border-radius: 8px;
    width: 34px;
    height: 34px;
    padding: 0;
    cursor: pointer;
    transition: all 0.15s ease;
}

.jempol-pick-btn:hover,
.jempol-pick-btn.aktif {
    border-color: #f0b429;
    background: #fff8e1;
    color: #d99a00;
}

.jempol-pick-btn.aktif {
    box-shadow: 0 2px 4px rgba(240, 180, 41, 0.35);
}

.jempol-select {
    min-width: 90px;
    font-size: 0.8rem;
}

tr.table-danger-light {
    background-color: #fff5f5;
}

tr.table-danger-light:hover {
    background-color: #ffe8e8;
}

.table-toolbar {
    padding: 0.5rem 0.75rem 0;
}

.pdf-preview-frame {
    display: block;
    width: 100%;
    height: 75vh;
    border: 0;
    background: #f8f9fa;
}

.laporan-export-toolbar .btn {
    white-space: nowrap;
}

.lckh-print-wrap .table-toolbar {
    padding-top: 0.25rem;
}

.stempel-footer {
    border-top: 1px solid #dee2e6;
    padding-top: 0.75rem;
}

.stempel-footer-inner {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 0.75rem;
}

.stempel-footer .stempel-key {
    font-size: 0.78rem;
    word-break: break-all;
    background: #fff;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

.stempel-footer .stempel-verify-link {
    word-break: break-all;
}

@media print {
    .app-sidebar, .app-topbar, .sidebar-backdrop, .app-footer,
    .navbar, .footer, .btn, .card-header form, .no-print, .table-toolbar, .modal { display: none !important; }
    .app-main { margin-left: 0 !important; }
    .app-content { padding: 0 !important; }
    .table-laporan-bulan { font-size: 10pt; }
    .lckh-print-wrap { display: block !important; }
    .jempol-display .jempol-img,
    .jempol-pick-btn .jempol-pick-icon {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .stempel-footer-inner {
        background: #fff !important;
        border-color: #ccc !important;
    }
}
