/* =============================================
   Charina House Management System - Styles
   ============================================= */

:root {
    --primary: #1a5276;
    --primary-light: #2980b9;
    --accent: #f39c12;
    --danger: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
    --sidebar-bg: #1a2332;
    --sidebar-text: #b2bec3;
    --sidebar-active: #2980b9;
    --bg: #f0f4f8;
    --white: #ffffff;
    --text: #2c3e50;
    --border: #dfe6e9;
    --shadow: 0 2px 15px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: var(--bg); color: var(--text); }

/* LAYOUT */
.wrapper { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
    width: 250px; min-height: 100vh; background: var(--sidebar-bg);
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 1000;
    overflow-y: auto; transition: width 0.3s;
}
.sidebar.collapsed { width: 60px; }
.sidebar.collapsed .sidebar-nav li a span,
.sidebar.collapsed .sidebar-brand span,
.sidebar.collapsed .nav-section { display: none; }
.sidebar-brand {
    padding: 20px 16px; display: flex; align-items: center; gap: 10px;
    color: white; font-size: 1.1rem; font-weight: 700; border-bottom: 1px solid #2c3e50;
}
.sidebar-brand i { color: var(--accent); font-size: 1.4rem; }
.sidebar-nav { list-style: none; padding: 10px 0; }
.sidebar-nav li a {
    display: flex; align-items: center; gap: 10px; padding: 10px 16px;
    color: var(--sidebar-text); text-decoration: none; font-size: 0.9rem;
    transition: all 0.2s; border-left: 3px solid transparent;
}
.sidebar-nav li a:hover, .sidebar-nav li a.active {
    background: rgba(41,128,185,0.15); color: white;
    border-left-color: var(--accent);
}
.sidebar-nav li a i { width: 18px; text-align: center; }
.nav-section {
    padding: 14px 16px 6px; font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; color: #636e72; letter-spacing: 1px;
}

/* MAIN CONTENT */
.main-content { margin-left: 250px; width: calc(100% - 250px); transition: all 0.3s; }
.sidebar.collapsed ~ .main-content { margin-left: 60px; width: calc(100% - 60px); }

/* TOPBAR */
.topbar {
    background: white; height: 60px; display: flex; align-items: center;
    justify-content: space-between; padding: 0 24px;
    border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
    position: sticky; top: 0; z-index: 100;
}
.sidebar-toggle { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-user { font-size: 0.9rem; color: var(--text); }
.btn-logout { background: var(--danger); color: white; padding: 6px 14px; border-radius: 5px; text-decoration: none; font-size: 0.85rem; }

/* CONTENT AREA */
.content-area { padding: 24px; }
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 1.6rem; color: var(--primary); }
.page-header p { color: #636e72; font-size: 0.9rem; margin-top: 4px; }

/* STAT CARDS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: white; border-radius: 10px; padding: 20px;
    box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px;
}
.stat-icon { width: 56px; height: 56px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.stat-icon.blue { background: #ebf3fb; color: var(--primary-light); }
.stat-icon.green { background: #eafaf1; color: var(--success); }
.stat-icon.orange { background: #fef9e7; color: var(--warning); }
.stat-icon.red { background: #fdedec; color: var(--danger); }
.stat-label { font-size: 0.8rem; color: #636e72; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text); }

/* CARDS */
.card { background: white; border-radius: 10px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card-header {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.card-header h2 { font-size: 1rem; color: var(--primary); }
.card-body { padding: 20px; }

/* TABLES */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead th { background: var(--primary); color: white; padding: 10px 12px; text-align: left; font-weight: 600; }
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.15s; }
tbody tr:hover { background: #f8f9fa; }
tbody td { padding: 10px 12px; }
.badge { padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge-success { background: #eafaf1; color: var(--success); }
.badge-danger { background: #fdedec; color: var(--danger); }
.badge-warning { background: #fef9e7; color: var(--warning); }
.badge-info { background: #ebf3fb; color: var(--primary-light); }

/* FORMS */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
    padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 0.875rem; background: white; color: var(--text);
    transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(41,128,185,0.1);
}
.form-section { border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.form-section-title { font-size: 0.85rem; font-weight: 700; color: var(--primary); text-transform: uppercase; margin-bottom: 12px; }

/* BUTTONS */
.btn { padding: 9px 18px; border-radius: 6px; border: none; cursor: pointer; font-size: 0.875rem; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; transition: all 0.2s; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

/* ALERTS */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 0.875rem; }
.alert-success { background: #eafaf1; color: #1e8449; border: 1px solid #a9dfbf; }
.alert-danger { background: #fdedec; color: #c0392b; border: 1px solid #f1948a; }
.alert-warning { background: #fef9e7; color: #b7770d; border: 1px solid #f8c471; }

/* LOGIN PAGE */
.login-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--sidebar-bg) 0%, var(--primary) 100%); }
.login-card { background: white; border-radius: 16px; padding: 40px; width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo i { font-size: 3rem; color: var(--primary); }
.login-logo h1 { font-size: 1.4rem; color: var(--primary); margin-top: 8px; }

/* RECEIPT */
.receipt-wrapper { max-width: 600px; margin: 0 auto; background: white; padding: 40px; border: 2px solid var(--primary); border-radius: 10px; }
.receipt-header { text-align: center; border-bottom: 2px solid var(--primary); padding-bottom: 16px; margin-bottom: 16px; }
.receipt-header h1 { font-size: 1.4rem; color: var(--primary); }
.receipt-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.receipt-total { background: var(--primary); color: white; padding: 12px; border-radius: 6px; display: flex; justify-content: space-between; font-weight: 700; margin-top: 8px; }

/* MODAL */
.modal-overlay { display:none; position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.5); z-index:2000; align-items:center; justify-content:center; }
.modal-overlay.active { display:flex; }
.modal { background:white; border-radius:10px; width:90%; max-width:700px; max-height:90vh; overflow-y:auto; }
.modal-header { padding:16px 20px; border-bottom:1px solid var(--border); display:flex; justify-content:space-between; align-items:center; }
.modal-body { padding:20px; }
.modal-footer { padding:16px 20px; border-top:1px solid var(--border); display:flex; justify-content:flex-end; gap:8px; }
.close-modal { background:none; border:none; font-size:1.4rem; cursor:pointer; color:#636e72; }

/* SEARCH / FILTER */
.search-bar { display:flex; gap:8px; margin-bottom:16px; flex-wrap:wrap; }
.search-bar input, .search-bar select { flex:1; min-width:150px; padding:8px 12px; border:1px solid var(--border); border-radius:6px; font-size:0.875rem; }

/* RESPONSIVE */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar .sidebar-nav li a span, .sidebar .sidebar-brand span, .sidebar .nav-section { display: none; }
    .main-content { margin-left: 60px; width: calc(100% - 60px); }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr; }
}

@media print {
    .sidebar, .topbar, .btn-group, .no-print { display: none !important; }
    .main-content { margin-left: 0; width: 100%; }
    .receipt-wrapper { border: 1px solid #000; }
}
