/* Custom styles for PosInd-Klik */

:root {
    --bs-primary: #1F3A93; /* Biru Delf */
    --bs-secondary: #E34234; /* Merah Cinnabar */
    --crm-blue: #1F3A93;
    --crm-red: #E34234;
    --crm-bg: #F0F2F5;
    --crm-surface: #FFFFFF;
    --crm-border: rgba(0,0,0,0.08);
    --crm-text: #111827;
    --crm-text-muted: #6B7280;
}

body {
    background-color: var(--crm-bg);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--crm-text);
}

.crm-topbar {
    min-height: 56px;
}

.crm-main {
    padding-top: 76px;
    padding-bottom: 20px;
}

body.crm-has-bottom-nav .crm-main {
    padding-bottom: 92px;
}

.crm-container {
    padding-left: 12px;
    padding-right: 12px;
}

@media (min-width: 992px) {
    .crm-main {
        padding-top: 84px;
    }
    .crm-container {
        padding-left: 0;
        padding-right: 0;
    }
}

.crm-navbar-brand {
    gap: 14px;
    flex-wrap: nowrap;
}

.crm-brand-logos {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    flex: 0 0 auto;
}

.crm-brand-posind {
    height: 44px;
    width: auto;
    display: block;
    filter: brightness(0) invert(1);
}

.crm-brand-title {
    white-space: nowrap;
    font-size: 18px;
    line-height: 1;
}

@media (max-width: 480px) {
    .crm-navbar-brand {
        gap: 10px;
        flex-wrap: wrap;
    }

    .crm-brand-logos {
        gap: 10px;
    }

    .crm-brand-title {
        font-size: 16px;
    }

    .crm-brand-posind { height: 38px; }
}

.card {
    border-radius: 14px;
    border-color: var(--crm-border);
}

.card.shadow, .card.shadow-sm {
    box-shadow: 0 10px 26px rgba(0,0,0,0.08) !important;
}

.btn {
    border-radius: 12px;
}

@media (max-width: 991.98px) {
    .btn {
        min-height: 38px;
        padding: 8px 12px;
        font-size: 14px;
        line-height: 1.1;
    }
    .btn.btn-sm {
        min-height: 38px;
        padding: 6px 10px;
        font-size: 12px;
        line-height: 1.1;
        border-radius: 10px;
        white-space: nowrap;
    }
}

@media (max-width: 767px) {
    h1, h2, h3 {
        letter-spacing: -0.01em;
    }
    h2 {
        font-size: 22px;
    }
}

.crm-login-logo {
    height: 80px;
    width: auto;
    display: inline-block;
    margin-bottom: 20px;
}

/* Primary Color Overrides */
.btn-primary, .bg-primary, .text-primary {
    background-color: var(--crm-blue) !important;
    border-color: var(--crm-blue) !important;
    color: white !important;
}

.text-primary {
    background-color: transparent !important;
    color: var(--crm-blue) !important;
}

.btn-primary:hover {
    background-color: #162a6e !important;
    border-color: #162a6e !important;
}

/* Secondary Color Overrides */
.btn-secondary, .bg-secondary, .text-secondary {
    background-color: var(--crm-red) !important;
    border-color: var(--crm-red) !important;
    color: white !important;
}

.text-secondary {
    background-color: transparent !important;
    color: var(--crm-red) !important;
}

.btn-secondary:hover {
    background-color: #c9302c !important;
    border-color: #c9302c !important;
}

.btn-outline-primary {
    color: var(--crm-blue);
    border-color: var(--crm-blue);
}

.btn-outline-primary:hover {
    background-color: var(--crm-blue);
    color: white;
}

/* Sidebar Styling */
.sidebar {
    height: 100vh;
    width: 250px;
    position: fixed;
    top: 0;
    left: 0;
    background-color: white;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    z-index: 1000;
    transition: all 0.3s;
}

/* Sidebar hidden state */
body.sidebar-toggled .sidebar {
    margin-left: -250px;
}
body.sidebar-toggled .main-content {
    margin-left: 0;
}

.sidebar-brand {
    padding: 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.sidebar-brand img {
    height: 40px;
    margin-right: 10px;
}

.sidebar-menu {
    padding: 10px;
    overflow-y: auto;
    height: calc(100vh - 81px);
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: #6c757d;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: all 0.2s;
}

.sidebar-link:hover {
    background-color: #f8f9fa;
    color: var(--crm-blue);
}

.sidebar-link.active {
    background-color: rgba(31, 58, 147, 0.1);
    color: var(--crm-blue);
    font-weight: 600;
    border-left: 4px solid var(--crm-red);
}

.menu-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 18px;
    border: 1px solid rgba(0,0,0,0.08);
    background: #ffffff;
    color: var(--crm-blue);
    box-shadow: 0 6px 14px rgba(0,0,0,0.08);
    font-size: 26px;
}

button.menu-icon-btn {
    appearance: none;
}

.menu-icon-btn:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(31,58,147,0.18), 0 6px 14px rgba(0,0,0,0.08);
}

.crm-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 68px;
    display: flex;
    background: var(--crm-surface);
    border-top: 1px solid var(--crm-border);
    z-index: 1030;
}

.crm-bottom-item {
    flex: 1;
    text-decoration: none;
    color: #6c757d;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 11px;
}

.crm-bottom-item i {
    font-size: 18px;
    line-height: 1;
}

.crm-bottom-item.active {
    color: var(--crm-blue);
}

.crm-bottom-item.active i {
    color: var(--crm-blue);
}

.table {
    color: var(--crm-text);
}

@media (max-width: 767px) {
    .table {
        font-size: 13px;
    }
    .table thead th {
        font-size: 12px;
    }
}

.dataTables_wrapper .dt-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.dataTables_wrapper .dt-buttons .btn {
    background: var(--crm-surface) !important;
    color: var(--crm-blue) !important;
    border: 1px solid var(--crm-border) !important;
    border-radius: 999px !important;
    padding: 6px 12px !important;
    font-size: 12px !important;
    line-height: 1.2;
}

.dataTables_wrapper .dt-buttons .btn:hover {
    background: rgba(31, 58, 147, 0.08) !important;
}

@media (max-width: 767px) {
    .dataTables_wrapper .dt-buttons {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .dataTables_wrapper .dt-buttons::-webkit-scrollbar {
        height: 6px;
    }
    .dataTables_wrapper .dt-buttons::-webkit-scrollbar-thumb {
        background: rgba(0,0,0,0.16);
        border-radius: 999px;
    }
    .dataTables_wrapper .dataTables_filter {
        width: 100%;
        text-align: left;
        margin: 8px 0 10px;
    }
    .dataTables_wrapper .dataTables_filter input {
        width: 100% !important;
        margin-left: 0 !important;
    }
}

.crm-bottom-item.active {
    color: var(--crm-blue);
    font-weight: 700;
}

@media (max-width: 991.98px) {
    body {
        padding-bottom: 76px;
    }
}

.sidebar-link i {
    font-size: 1.1rem;
}

.main-content {
    margin-left: 250px;
    padding: 20px;
    min-height: 100vh;
}

/* Responsive Sidebar */
@media (max-width: 768px) {
    .sidebar {
        margin-left: -250px;
    }
    .sidebar.active {
        margin-left: 0;
    }
    .main-content {
        margin-left: 0;
    }
}

/* Dashboard Cards */
.stat-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 15px;
}

.bg-orange-soft { background-color: #FFF3E0; color: #E65100; }
.bg-blue-soft { background-color: #E3F2FD; color: #1565C0; }
.bg-red-soft { background-color: #FFEBEE; color: #C62828; }
.bg-green-soft { background-color: #E8F5E9; color: #2E7D32; }

.card {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,.05);
}

.card-header {
    background-color: white;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    font-weight: 600;
    color: var(--crm-blue);
}

.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
    background-color: var(--crm-blue) !important;
}

.btn {
    border-radius: 0.5rem;
}

/* PWA specific adjustments */
@media all and (display-mode: standalone) {
    /* Adjustments for standalone mode if needed */
    /* body { padding-top: env(safe-area-inset-top); } */
}

/* Login Button Style */
.btn-pos-login {
    background-color: var(--crm-blue);
    border-color: var(--crm-blue);
    color: white;
    font-weight: bold;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.btn-pos-login:hover {
    background-color: var(--crm-red);
    border-color: var(--crm-red);
    color: white;
}

/* Login Background */
.login-container {
    display: flex;
    min-height: 100vh;
}

.login-image {
    flex: 1;
    background-image: url('/static/login_bg.png'); /* Placeholder, update with actual file */
    background-size: cover;
    background-position: center;
    position: relative;
}

.login-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(31, 58, 147, 0.4); /* Overlay Biru Delf transparent */
}

.login-form-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background-color: white;
}

@media (max-width: 768px) {
    .login-image {
        display: none;
    }
}

.crm-timeline-scroll {
    -webkit-overflow-scrolling: touch;
}

.crm-timeline-table {
    width: max-content;
    min-width: 100%;
    table-layout: fixed;
}

.crm-timeline-table thead th {
    white-space: nowrap;
}

.crm-timeline-table .timeline-col-no,
.crm-timeline-table .timeline-col-phase,
.crm-timeline-table .timeline-col-progress {
    position: sticky;
    z-index: 2;
}

.crm-timeline-table .timeline-col-no {
    left: 0;
    background: #ffffff;
}

.crm-timeline-table thead .timeline-col-no {
    background: var(--bs-table-bg, #f8f9fa);
}

.crm-timeline-table .timeline-col-phase {
    left: 48px;
    background: #ffffff;
    white-space: normal;
}

.crm-timeline-table thead .timeline-col-phase {
    background: var(--bs-table-bg, #f8f9fa);
}

.crm-timeline-table .timeline-col-progress {
    right: 0;
    background: #ffffff;
}

.crm-timeline-table thead .timeline-col-progress {
    background: var(--bs-table-bg, #f8f9fa);
}

.crm-timeline-table .timeline-week-cell {
    padding: 0;
    height: 26px;
}

.crm-timeline-table .timeline-week-check {
    margin: 0;
    width: 14px;
    height: 14px;
    vertical-align: middle;
}

@media (max-width: 575px) {
    .crm-timeline-table .timeline-col-phase {
        min-width: 200px;
    }

    .crm-timeline-table .timeline-col-progress {
        min-width: 160px;
    }

    .crm-timeline-table .timeline-actions {
        width: 100%;
    }

    .crm-timeline-table .timeline-actions .btn {
        flex: 1 1 auto;
    }

    .crm-timeline-table .timeline-week-cell {
        height: 24px;
    }

    .crm-timeline-table .timeline-week-check {
        width: 12px;
        height: 12px;
    }
}
