/* Collection Management System - Modern SaaS Dashboard */

:root {
    --sidebar-width: 260px;
    --navbar-height: 60px;
    --primary-color: #f97316;
    --primary-dark: #ea580c;
    --sidebar-bg: #111827;
    --sidebar-hover: #1f2937;
    --body-bg: #f9fafb;
    --card-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.06);
}

[data-theme="dark"] {
    --body-bg: #0f172a;
    --card-bg: #1e293b;
    --text-color: #e2e8f0;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    background:
        radial-gradient(1200px 500px at 50% -10%, #fff7ed 0%, rgba(255, 247, 237, 0) 60%),
        linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}

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

.login-logo {
    width: 78px;
    height: 78px;
    border-radius: 999px;
    margin: 0 auto 14px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    box-shadow: 0 10px 25px -10px rgb(249 115 22 / 0.45);
}

.login-logo-img {
    max-width: 60px;
    max-height: 60px;
    object-fit: contain;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

.login-card .form-control {
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    padding-left: 14px;
    padding-right: 14px;
}

.login-card .form-control:focus {
    border-color: #f97316;
    box-shadow: 0 0 0 0.25rem rgb(249 115 22 / 0.20);
    background: #fff;
}

.btn-login {
    background: #f97316;
    border-color: #f97316;
    color: #fff;
    font-weight: 600;
    border-radius: 12px;
    padding-top: 12px;
    padding-bottom: 12px;
}

.btn-login:hover,
.btn-login:focus {
    background: #ea580c;
    border-color: #ea580c;
    color: #fff;
}

.btn-login:active {
    background: #c2410c !important;
    border-color: #c2410c !important;
}

.login-footer {
    font-size: 0.875rem;
    text-align: center;
}

/* Dashboard Layout */
.dashboard-body {
    min-height: 100vh;
    /* Soft gradient background untuk nuansa lebih fresh (Gen-Z) */
    background:
        radial-gradient(900px 400px at 0% 0%, #ffedd5 0%, rgba(255, 237, 213, 0) 55%),
        radial-gradient(900px 400px at 100% 0%, #e0f2fe 0%, rgba(224, 242, 254, 0) 55%),
        linear-gradient(180deg, #f9fafb 0%, #e5e7eb 100%);
    display: flex;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, margin 0.3s ease, width 0.25s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-brand {
    color: #fff !important;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand:hover {
    color: #e2e8f0 !important;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #f97316;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.4);
}

.sidebar-logo-img {
    max-width: 26px;
    max-height: 26px;
    object-fit: contain;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.sidebar-brand-title {
    font-weight: 700;
    letter-spacing: 0.02em;
}

.sidebar-brand-subtitle {
    font-size: 0.7rem;
    color: #e5e7eb;
    opacity: 0.85;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.sidebar-nav .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: rgba(249, 115, 22, 0.14);
    color: #fff;
    border-left-color: var(--primary-color);
}

.sidebar-nav .nav-link i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
}

.user-role {
    font-size: 0.7rem;
    margin-top: 2px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.sidebar-collapsed .sidebar {
    width: 72px;
}

body.sidebar-collapsed .main-content {
    margin-left: 72px;
}

body.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .sidebar-nav .nav-link span,
body.sidebar-collapsed .sidebar-footer .user-details {
    display: none;
}

body.sidebar-collapsed .sidebar-nav .nav-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

body.sidebar-collapsed .sidebar-footer {
    justify-content: center;
}

.sidebar-collapse-toggle {
    position: fixed;
    top: 50%;
    left: var(--sidebar-width);
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: none;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.35);
    cursor: pointer;
    z-index: 1100;
    transition: left 0.25s ease, background 0.2s ease, transform 0.2s ease;
}

.sidebar-collapse-toggle:hover {
    background: var(--primary-dark);
}

body.sidebar-collapsed .sidebar-collapse-toggle {
    left: 72px;
}

/* Navbar */
.navbar-custom {
    height: var(--navbar-height);
    background: #fff;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--card-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.dark-mode-toggle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #f1f5f9;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: all 0.2s;
}

.dark-mode-toggle:hover {
    background: #e2e8f0;
    color: #1e293b;
}

[data-theme="dark"] .navbar-custom { background: #1e293b; }
[data-theme="dark"] .page-title { color: #e2e8f0; }

/* Content */
.content-wrapper {
    flex: 1;
    padding: 24px;
}

/* Stat Cards */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s;
}

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

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card-primary .stat-icon { background: rgba(249, 115, 22, 0.12); color: #f97316; }
.stat-card-info .stat-icon { background: rgba(6, 182, 212, 0.1); color: #06b6d4; }
.stat-card-success .stat-icon { background: rgba(34, 197, 94, 0.1); color: #22c55e; }
.stat-card-warning .stat-icon { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.stat-card-secondary .stat-icon { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.stat-card-dark .stat-icon { background: rgba(30, 41, 59, 0.1); color: #64748b; }

.stat-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px 0;
}

.stat-content p {
    margin: 0;
    color: #64748b;
    font-size: 0.875rem;
}

/* Dashboard welcome & quick stats */
.welcome-card {
    border: none;
    border-radius: 16px;
    background: #eff6ff;
}
.welcome-icon {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 10px 25px -10px rgba(15, 23, 42, 0.6);
}
.quick-stats-card .card-header {
    background: var(--primary-color);
    color: #fff;
    border-bottom: none;
    border-left: none;
}
.quick-stats-card .card-header h5 {
    color: #fff;
}
.quick-stats-card .quick-stats-period {
    font-size: 0.8rem;
    color: #e5e7eb;
}
.quick-stats-card .card-body {
    background: #ffffff;
}

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    border-left: 4px solid var(--primary-color);
    padding: 12px 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.card-header h5 {
    color: var(--primary-color);
    margin: 0;
}

.card-body {
    padding: 20px;
}

/* Main Footer */
.main-footer {
    padding: 16px 24px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    font-size: 0.875rem;
    color: #64748b;
}

/* Tables */
.table th {
    font-weight: 600;
    color: #64748b;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.table-hover tbody tr:hover {
    background-color: #f9fafb;
}

/* Badges */
.badge { font-weight: 500; }

/* Buttons */
.btn-detail, .btn-update-status { margin-right: 4px; }

/* Modal */
.modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}

/* Modal Detail Nasabah - Redesign sesuai mockup */
.modal-detail-nasabah .modal-content { border-radius: 16px; overflow: hidden; }
.modal-detail-header {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: #fff;
    padding: 16px 24px;
    border: none;
}
.modal-detail-header .modal-title { font-size: 1.25rem; }
.modal-detail-body { padding: 24px; background: #f8fafc; }
.modal-detail-footer {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: #fff;
    padding: 16px 24px;
    border: none;
}
.modal-detail-footer .btn-light {
    background: rgba(255,255,255,0.95);
    color: #ea580c;
    font-weight: 600;
    border: none;
}
.modal-detail-footer .btn-light:hover {
    background: #fff;
    color: #c2410c;
}

.detail-nasabah-modal { background: transparent; padding: 0; }
.detail-nasabah-modal .detail-three-cols {
    background: #fff;
    padding: 24px;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
    border: none;
}
.detail-nasabah-modal .detail-three-cols .detail-col-table {
    width: 100%;
    border-collapse: collapse;
}
.detail-nasabah-modal .detail-row {
    border-bottom: 1px solid #e5e7eb;
}
.detail-nasabah-modal .detail-row:last-child {
    border-bottom: none;
}
.detail-nasabah-modal .detail-row td {
    vertical-align: top;
    padding: 10px 12px;
}
.detail-nasabah-modal .detail-row:first-child td {
    padding-top: 0;
}
.detail-nasabah-modal .detail-label {
    font-size: 0.8rem;
    color: #6b7280 !important;
    width: 38%;
    padding-right: 16px !important;
    border: none !important;
}
.detail-nasabah-modal .detail-label::before {
    content: "▪";
    font-size: 0.65rem;
    color: #f97316;
    margin-right: 8px;
    vertical-align: middle;
}
.detail-nasabah-modal .detail-value {
    font-size: 0.9rem;
    color: #111827 !important;
    padding: 0 !important;
    border: none !important;
    line-height: 1.5;
    font-weight: 500;
}
.detail-nasabah-modal .detail-nasabah-full td { padding: 6px 10px 6px 0; border-bottom: 1px solid #f1f5f9; }
.detail-nasabah-modal .detail-nasabah-full tr:last-child td { border-bottom: none; }
.detail-nasabah-modal .history-table th { background: #f1f5f9; font-size: 0.78rem; }
.detail-nasabah-modal .history-table td { font-size: 0.78rem; vertical-align: top; }

/* Phone cards - 4 kartu horizontal dengan header oranye */
.phone-blocks-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
@media (min-width: 992px) {
    .phone-blocks-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.phone-card-detail {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
    border: 1px solid #e2e8f0;
}
.phone-card-header {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 10px 14px;
}
.phone-card-body {
    padding: 14px;
}
.phone-card-body .phone-number { font-size: 0.95rem; color: #111827; }
.phone-card-body .phone-actions .btn { padding: 6px 12px; font-size: 0.8rem; font-weight: 500; }
.phone-card-body .btn-telepon {
    background: #0ea5e9;
    border-color: #0ea5e9;
    color: #fff;
}
.phone-card-body .btn-telepon:hover {
    background: #0284c7;
    border-color: #0284c7;
    color: #fff;
}
.phone-card-body .btn-whatsapp {
    background: #22c55e;
    border-color: #22c55e;
    color: #fff;
}
.phone-card-body .btn-whatsapp:hover {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
}

/* Legacy fallback */
.phone-block-detail {
    padding: 14px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}
.phone-block-detail .phone-number { font-size: 0.95rem; color: #111827; }
.phone-block-detail .phone-actions .btn { padding: 5px 10px; font-size: 0.78rem; }
.btn-telegram-detail { background: #0ea5e9; border-color: #0ea5e9; color: #fff; }
.btn-telegram-detail:hover { background: #0284c7; border-color: #0284c7; color: #fff; }

.phone-block {
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}
.phone-block .phone-number { font-size: 1rem; color: #1e293b; }
.phone-block .phone-actions .btn { padding: 6px 12px; font-size: 0.8rem; }
.phone-block .btn-success { background: #22c55e; border-color: #22c55e; }
.phone-block .btn-success:hover { background: #16a34a; border-color: #16a34a; }
.modal-header.bg-primary .modal-title { color: #fff; }
.modal-footer.bg-primary { border-top: 1px solid rgba(255,255,255,0.2); }
.modal-footer.bg-primary .btn-light { color: var(--primary-color); }

/* Global primary / orange theme */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}
.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}
.btn-primary:active {
    background-color: #c2410c !important;
    border-color: #c2410c !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}
.text-primary {
    color: var(--primary-color) !important;
}

/* Responsive */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
}

/* Dark Mode */
[data-theme="dark"] .stat-card,
[data-theme="dark"] .card { background: var(--card-bg); }
[data-theme="dark"] .stat-content h3,
[data-theme="dark"] .card-header { color: var(--text-color); }
[data-theme="dark"] .stat-content p { color: #94a3b8; }
[data-theme="dark"] .card-header { border-color: #334155; }
[data-theme="dark"] .main-footer { background: #1e293b; border-color: #334155; color: #94a3b8; }
[data-theme="dark"] .table { color: var(--text-color); }
[data-theme="dark"] .table th { color: #94a3b8; }

/* Watermark - user name on all data pages */
.watermark-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2000;
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;
    gap: 24px;
    padding: 24px;
}

.watermark-text {
    font-size: clamp(0.8rem, 1.5vw, 1.1rem);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: rgba(15, 23, 42, 0.06);
    transform: rotate(-25deg);
    white-space: nowrap;
    user-select: none;
}

[data-theme="dark"] .watermark-text {
    color: rgba(148, 163, 184, 0.1);
}
