/* Koptanu Ecosystem - Core Design System & Stylesheet */
:root {
    --primary-color: #2E7D32;       /* Emerald Green */
    --primary-dark: #1B5E20;        /* Forest Green */
    --primary-light: #C8E6C9;       /* Light Sage Green */
    --primary-accent: #81C784;      /* Soft Accent Green */
    --secondary-color: #43A047;     /* Vibrant Green */
    --bg-color: #F4F6F4;            /* Soft Off-White */
    --surface-color: #FFFFFF;       /* Pure White */
    --text-primary: #1C2D1F;        /* Deep Slate Green/Charcoal */
    --text-secondary: #5C6E61;      /* Muted Sage */
    --border-color: #E0E6E1;        /* Light Grey-Green Border */
    --success-color: #2E7D32;       /* Emerald Green */
    --danger-color: #C62828;        /* Soft Crimson Red */
    --warning-color: #EF6C00;       /* Dark Amber Orange */
    --info-color: #1565C0;          /* Deep Blue */
    --shadow-sm: 0 2px 4px rgba(46, 125, 50, 0.05);
    --shadow-md: 0 4px 12px rgba(46, 125, 50, 0.08);
    --shadow-lg: 0 8px 24px rgba(46, 125, 50, 0.12);
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 20px;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* Utilities */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: var(--font-sans);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    box-shadow: 0 4px 10px rgba(46, 125, 50, 0.2);
}

.btn-secondary {
    background-color: var(--surface-color);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-color);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #B71C1C;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: var(--primary-dark);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
    font-size: 1rem;
    pointer-events: none;
}

.input-wrapper input,
.input-wrapper select,
.input-wrapper textarea,
.form-control {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    font-size: 0.95rem;
    font-family: var(--font-sans);
    background-color: var(--surface-color);
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    outline: none;
    transition: var(--transition-fast);
}

.input-wrapper select {
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg fill='%235C6E61' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
    background-repeat: no-repeat;
    background-position: right 1rem center;
}

.input-wrapper input:focus,
.input-wrapper select:focus,
.input-wrapper textarea:focus,
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15);
}

.password-toggle-btn {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle-btn:hover {
    color: var(--primary-color);
}

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.alert-icon {
    font-size: 1.1rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.alert-danger {
    background-color: #FFEBEE;
    color: #C62828;
    border-color: #FFCDD2;
}

.alert-success {
    background-color: #E8F5E9;
    color: #2E7D32;
    border-color: #C8E6C9;
}

/* Auth Layout */
.auth-body {
    background: linear-gradient(135deg, #1B5E20 0%, #2E7D32 50%, #C8E6C9 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.15);
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.auth-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-logo {
    width: 60px;
    height: 60px;
    background-color: var(--primary-color);
    color: white;
    font-size: 1.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem auto;
    box-shadow: 0 4px 10px rgba(46, 125, 50, 0.3);
}

.auth-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.auth-footer p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.demo-accounts {
    background-color: var(--bg-color);
    border-radius: var(--border-radius-sm);
    padding: 0.75rem;
    margin-top: 1rem;
    text-align: left;
    font-size: 0.8rem;
    border-left: 3px solid var(--primary-color);
}

.demo-accounts span {
    display: inline-block;
    margin-top: 0.2rem;
}

.demo-accounts code {
    background-color: #E0E6E1;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-family: monospace;
}

/* App Core Layout (Admin Panel Dashboard) */
.admin-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    background-color: var(--primary-dark);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
}

.sidebar-logo i {
    font-size: 1.5rem;
    margin-right: 0.75rem;
    background-color: white;
    color: var(--primary-dark);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo span {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-menu {
    list-style: none;
    flex-grow: 1;
}

.sidebar-item {
    margin-bottom: 0.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.85);
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    transition: var(--transition-fast);
}

.sidebar-link i {
    margin-right: 0.75rem;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar-link:hover, 
.sidebar-item.active .sidebar-link {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
}

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

.sidebar-user {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    background-color: var(--primary-accent);
    color: var(--primary-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-right: 0.75rem;
}

.sidebar-user-info span {
    display: block;
}

.sidebar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: var(--primary-light);
}

.admin-main {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

.admin-header {
    background-color: var(--surface-color);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.header-title h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.header-actions {
    display: flex;
    align-items: center;
}

.admin-content {
    padding: 2rem;
    flex-grow: 1;
}

/* Card Widgets */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--surface-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--primary-color);
    transition: var(--transition-normal);
}

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

.stat-info h3 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-icon {
    font-size: 1.75rem;
    color: var(--primary-color);
    background-color: rgba(46, 125, 50, 0.1);
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Card Box Container */
.card-box {
    background-color: var(--surface-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

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

.card-box-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-dark);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    font-size: 0.95rem;
}

.table th, .table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background-color: var(--bg-color);
    font-weight: 600;
    color: var(--text-secondary);
}

.table tr:hover {
    background-color: rgba(46, 125, 50, 0.02);
}

/* Badges */
.badge {
    display: inline-flex;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background-color: #E8F5E9;
    color: #2E7D32;
}

.badge-warning {
    background-color: #FFF3E0;
    color: #E65100;
}

.badge-danger {
    background-color: #FFEBEE;
    color: #C62828;
}

.badge-info {
    background-color: #E3F2FD;
    color: #0D47A1;
}

/* Mobile Portal (Sahabat Koptanu) */
.mobile-layout {
    max-width: 480px;
    margin: 0 auto;
    background-color: var(--bg-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

.mobile-header {
    background-color: var(--primary-color);
    color: white;
    padding: 1.25rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom-left-radius: var(--border-radius-md);
    border-bottom-right-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.mobile-header h1 {
    font-size: 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.mobile-header h1 i {
    margin-right: 0.5rem;
}

.mobile-header-user {
    display: flex;
    align-items: center;
}

.mobile-logout-btn {
    color: white;
    font-size: 1.2rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
}

.mobile-content {
    padding: 1rem;
    flex-grow: 1;
    padding-bottom: 5rem; /* Space for bottom navigation */
}

/* Bottom Navigation Bar for Mobile */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    z-index: 100;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.25rem 0;
    flex-grow: 1;
}

.mobile-nav-item i {
    font-size: 1.2rem;
    margin-bottom: 0.2rem;
}

.mobile-nav-item:hover, .mobile-nav-item.active {
    color: var(--primary-color);
}

/* Card UI for Payments (Jan - Dec) */
.month-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

@media(max-width: 360px) {
    .month-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.month-card {
    background-color: var(--surface-color);
    border-radius: var(--border-radius-sm);
    padding: 0.75rem;
    text-align: center;
    border: 1.5px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.month-card.lunas {
    border-color: var(--primary-accent);
    background-color: rgba(46, 125, 50, 0.03);
}

.month-card.belum {
    border-color: #FFCDD2;
    background-color: rgba(198, 40, 40, 0.01);
}

.month-card.menunggu {
    border-color: #FFE082;
    background-color: rgba(255, 224, 130, 0.05);
}

.month-card .month-name {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}

.month-card .month-status {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
}

/* Thermal Printer Simulated CSS */
.receipt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.receipt-box {
    background-color: #FFF;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
}

.receipt-paper {
    background-color: #FFFDF0; /* Off-white paper style */
    padding: 1.5rem 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    color: #000;
    border: 1px solid #CCC;
    border-bottom: 12px dashed #AAA; /* Torn paper style */
    margin: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.receipt-header {
    text-align: center;
    margin-bottom: 1rem;
}

.receipt-title {
    font-weight: bold;
    font-size: 1rem;
    text-transform: uppercase;
}

.receipt-separator {
    border-top: 1px dashed #000;
    margin: 0.5rem 0;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.3rem;
}

.receipt-footer {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.75rem;
}

.receipt-actions {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    background-color: var(--bg-color);
    border-bottom-left-radius: var(--border-radius-sm);
    border-bottom-right-radius: var(--border-radius-sm);
}

/* Image preview placeholder style */
.image-preview-container {
    width: 100%;
    aspect-ratio: 85.6 / 53.98;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    background-color: var(--bg-color);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-fast);
}

.image-preview-container:hover {
    border-color: var(--primary-color);
}

.image-preview-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Accordion or Tabs for Agent views */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* General Layout helpers */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Mobile Admin Header Navigation */
.mobile-admin-header {
    display: none;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

@media(max-width: 768px) {
    .admin-layout {
        grid-template-columns: 1fr;
        padding-top: 56px; /* Space for sticky mobile header */
    }
    .mobile-admin-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.75rem 1.25rem;
        background-color: var(--primary-dark);
        color: white;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        z-index: 1000;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }
    .mobile-sidebar-toggle {
        background: none;
        border: none;
        color: white;
        font-size: 1.4rem;
        cursor: pointer;
        padding: 0.25rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .mobile-logo {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-weight: 700;
        font-size: 1.15rem;
    }
    .mobile-logo i {
        background-color: white;
        color: var(--primary-dark);
        width: 28px;
        height: 28px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1rem;
    }
    .admin-sidebar {
        position: fixed;
        top: 0;
        left: -260px;
        width: 260px;
        height: 100vh;
        z-index: 1001;
        transition: left 0.3s ease;
        box-shadow: 5px 0 15px rgba(0,0,0,0.15);
    }
    .admin-sidebar.open {
        left: 0;
    }
    .grid-2 {
        grid-template-columns: 1fr;
    }
    .admin-header {
        padding: 1rem;
    }
}
