@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --primary-dark: #3730a3;
    --secondary: #64748b;
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --info: #0284c7;
    --info-light: #f0f9ff;
    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-soft: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
    --shadow-hover: 0 10px 25px -3px rgba(79, 70, 229, 0.12), 0 4px 10px -2px rgba(0, 0, 0, 0.04);
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* Sidebar & Layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 270px;
    background: #ffffff;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1030;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
    padding: 1.5rem 1.25rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.sidebar-menu {
    padding: 1.25rem 0.75rem;
    flex: 1;
    overflow-y: auto;
}

.menu-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.5rem 0.75rem 0.35rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.925rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    margin-bottom: 3px;
}

.sidebar-link i {
    font-size: 1.15rem;
    color: var(--secondary);
    transition: color 0.2s ease;
}

.sidebar-link:hover {
    background-color: #f1f5f9;
    color: var(--primary);
}

.sidebar-link:hover i {
    color: var(--primary);
}

.sidebar-link.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-link.active i {
    color: var(--primary);
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: #fafbfc;
}

.main-content {
    margin-left: 270px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Top Navbar */
.top-navbar {
    background: #ffffff;
    height: 70px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.content-body {
    padding: 2rem 1.75rem 3rem;
    flex: 1;
}

/* Cards & Surface */
.card-modern {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-modern:hover {
    box-shadow: var(--shadow-hover);
}

.card-header-modern {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body-modern {
    padding: 1.5rem;
}

/* Metric / Stat Card */
.stat-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.5rem;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-val {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    margin-top: 0.35rem;
    letter-spacing: -0.02em;
}

/* Modern Pill Badges */
.badge-pill {
    padding: 0.35rem 0.8rem;
    border-radius: 9999px;
    font-size: 0.775rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    letter-spacing: 0.01em;
}

.badge-kosong {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.badge-terisi {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.badge-jatuh-tempo, .badge-warning-custom {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}

.badge-renovasi, .badge-danger-custom {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.badge-lunas {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.badge-belum {
    background: #fff1f2;
    color: #e11d48;
    border: 1px solid #fecdd3;
}

/* Magic Tabs */
.magic-tabs {
    display: inline-flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 9999px;
    border: 1px solid #e2e8f0;
}

.magic-tab-btn {
    border: none;
    background: transparent;
    padding: 0.45rem 1.25rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.magic-tab-btn.active, .magic-tab-btn:hover {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Magic Toolbar with Hover Expand Actions */
.magic-toolbar {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: var(--shadow-soft);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.magic-action-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.magic-expand-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.magic-expand-btn span {
    max-width: 0;
    opacity: 0;
    display: inline-block;
    transition: max-width 0.3s ease, opacity 0.25s ease;
    overflow: hidden;
    vertical-align: middle;
}

.magic-expand-btn:hover span {
    max-width: 140px;
    opacity: 1;
    margin-left: 6px;
}

/* Interactive Room Grid / Denah Status Pintu */
.room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}

.door-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-color);
    padding: 1.25rem;
    position: relative;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.door-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.door-card.status-kosong {
    border-color: #10b981;
    background: linear-gradient(180deg, #ffffff 70%, #ecfdf5 100%);
}

.door-card.status-terisi {
    border-color: #3b82f6;
    background: linear-gradient(180deg, #ffffff 70%, #eff6ff 100%);
}

.door-card.status-jatuh-tempo {
    border-color: #f59e0b;
    background: linear-gradient(180deg, #ffffff 70%, #fffbeb 100%);
}

.door-card.status-renovasi {
    border-color: #ef4444;
    background: linear-gradient(180deg, #ffffff 70%, #fef2f2 100%);
}

.door-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.door-number {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.door-property-tag {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.door-tenant-info {
    font-size: 0.875rem;
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px dashed var(--border-color);
}

/* Buttons */
.btn-primary-custom {
    background-color: var(--primary);
    color: #ffffff;
    font-weight: 600;
    border-radius: var(--radius-md);
    padding: 0.55rem 1.25rem;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-primary-custom:hover {
    background-color: var(--primary-hover);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.btn-wa {
    background-color: #25d366;
    color: #ffffff;
    font-weight: 600;
    border-radius: var(--radius-md);
    padding: 0.45rem 1rem;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-wa:hover {
    background-color: #20ba5a;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

/* Tables */
.table-modern {
    width: 100%;
    margin-bottom: 0;
    color: var(--text-primary);
    vertical-align: middle;
}

.table-modern th {
    background: #f8fafc;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.table-modern td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.table-modern tr:hover td {
    background-color: #f8fafc;
}

/* Mobile Portal specific responsive */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
}

/* Print Styles */
@media print {
    body {
        background: #fff;
    }
    .no-print, .sidebar, .top-navbar, .magic-toolbar {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    .content-body {
        padding: 0 !important;
    }
}

