/* =====================================================
   E-DOSEN RPS GENERATOR - PROFESSIONAL CSS
   ===================================================== */

:root {
    --primary: #1e40af;
    --primary-dark: #1e3a8a;
    --primary-light: #3b82f6;
    --secondary: #059669;
    --accent: #f59e0b;
    --danger: #dc2626;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
    --shadow-lg: 0 10px 20px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.05);
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    line-height: 1.6;
    font-size: 14px;
}

/* ===== AUTH PAGES ===== */
.auth-wrap {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: linear-gradient(135deg, #1e40af 0%, #059669 100%);
}
.auth-brand {
    color: white;
    padding: 60px 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,.08) 0%, transparent 50%);
}
.auth-brand h1 {
    font-size: 42px;
    margin: 0 0 16px;
    font-weight: 800;
    letter-spacing: -1px;
}
.auth-brand p {
    font-size: 17px;
    opacity: .92;
    max-width: 480px;
    margin: 0 0 32px;
}
.auth-features {
    list-style: none;
    padding: 0;
    margin: 0;
}
.auth-features li {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    font-size: 15px;
}
.auth-features li .ico {
    width: 36px; height: 36px;
    background: rgba(255,255,255,.18);
    border-radius: 10px;
    display: grid; place-items: center;
    font-size: 18px;
}
.auth-card-wrap {
    display: grid;
    place-items: center;
    background: white;
    padding: 40px;
}
.auth-card {
    width: 100%;
    max-width: 420px;
}
.auth-card h2 {
    font-size: 28px;
    margin: 0 0 8px;
    font-weight: 700;
}
.auth-card .sub {
    color: var(--text-muted);
    margin: 0 0 28px;
}
@media (max-width: 900px) {
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-brand { padding: 40px 28px; }
    .auth-brand h1 { font-size: 30px; }
}

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
    font-size: 13px;
}
.form-group .hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}
.form-control, select, textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30,64,175,.12);
}
textarea { min-height: 90px; resize: vertical; }
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-row-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 700px) {
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: transform .1s, box-shadow .15s, background .15s;
    font-family: inherit;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-primary    { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success    { background: var(--secondary); color: white; }
.btn-success:hover { background: #047857; }
.btn-warning    { background: var(--accent); color: white; }
.btn-danger     { background: var(--danger); color: white; }
.btn-secondary  { background: #f1f5f9; color: var(--text); border: 1px solid var(--border); }
.btn-outline    { background: white; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-sm         { padding: 6px 12px; font-size: 12px; }
.btn-lg         { padding: 13px 26px; font-size: 15px; }
.btn-block      { display: flex; width: 100%; justify-content: center; }

/* ===== LAYOUT ===== */
.layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}
.sidebar {
    background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 100%);
    color: white;
    padding: 24px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar-brand {
    padding: 0 24px 24px;
    border-bottom: 1px solid rgba(255,255,255,.12);
    margin-bottom: 16px;
}
.sidebar-brand h2 {
    font-size: 22px;
    margin: 0;
    font-weight: 800;
    letter-spacing: -.5px;
}
.sidebar-brand .tagline {
    font-size: 11px;
    opacity: .7;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}
.sidebar-nav { list-style: none; padding: 0; margin: 0; }
.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 24px;
    color: rgba(255,255,255,.85);
    text-decoration: none;
    font-size: 14px;
    transition: background .12s, color .12s;
    border-left: 3px solid transparent;
}
.sidebar-nav li a:hover {
    background: rgba(255,255,255,.08);
    color: white;
}
.sidebar-nav li a.active {
    background: rgba(255,255,255,.12);
    color: white;
    border-left-color: var(--accent);
    font-weight: 600;
}
.sidebar-nav .section-label {
    padding: 18px 24px 8px;
    font-size: 11px;
    color: rgba(255,255,255,.5);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

.main { padding: 0; min-height: 100vh; background: var(--bg); }
.topbar {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 14px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar h1 {
    font-size: 18px;
    margin: 0;
    font-weight: 700;
}
.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}
.user-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 14px;
}
.user-info .nm { font-weight: 600; font-size: 13px; }
.user-info .rl { color: var(--text-muted); font-size: 12px; }

.content { padding: 28px 32px; }

@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { display: none; }
}

/* ===== CARDS ===== */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 20px;
    overflow: hidden;
}
.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-header h3 {
    font-size: 15px;
    margin: 0;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}
.card-header .ico-badge {
    width: 28px; height: 28px;
    background: rgba(30,64,175,.1);
    color: var(--primary);
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: 14px;
}
.card-body { padding: 24px; }

/* ===== DASHBOARD GRID ===== */
.welcome-banner {
    background: linear-gradient(120deg, #1e40af 0%, #3b82f6 60%, #059669 100%);
    color: white;
    padding: 32px 36px;
    border-radius: 14px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}
.welcome-banner::after {
    content: '';
    position: absolute;
    top: -50%; right: -10%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,.12) 0%, transparent 70%);
    border-radius: 50%;
}
.welcome-banner h2 { font-size: 26px; margin: 0 0 8px; font-weight: 800; }
.welcome-banner p { margin: 0; opacity: .92; max-width: 600px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: white;
    padding: 22px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.stat-card .label { color: var(--text-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat-card .num { font-size: 30px; font-weight: 800; margin-top: 6px; line-height: 1; }
.stat-card .ico {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 20px;
}
.stat-card .ico.blue { background: rgba(30,64,175,.1); color: var(--primary); }
.stat-card .ico.green { background: rgba(5,150,105,.1); color: var(--secondary); }
.stat-card .ico.amber { background: rgba(245,158,11,.1); color: var(--accent); }
.stat-card .ico.red { background: rgba(220,38,38,.1); color: var(--danger); }

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}
.feature-card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 22px;
    text-decoration: none;
    color: var(--text);
    transition: transform .15s, box-shadow .15s, border-color .15s;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}
.feature-card .ico {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: grid; place-items: center;
    font-size: 22px;
    background: rgba(30,64,175,.08);
    color: var(--primary);
}
.feature-card h4 { margin: 0; font-size: 16px; font-weight: 700; }
.feature-card p { margin: 0; font-size: 13px; color: var(--text-muted); }

/* ===== TABLES ===== */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}
.table th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 2px solid var(--border);
}
.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover { background: #fafbfc; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.badge-draft { background: #fef3c7; color: #92400e; }
.badge-final { background: #d1fae5; color: #065f46; }

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    border-left: 4px solid;
}
.alert-success { background: #ecfdf5; color: #065f46; border-color: #059669; }
.alert-danger  { background: #fef2f2; color: #991b1b; border-color: #dc2626; }
.alert-info    { background: #eff6ff; color: #1e3a8a; border-color: #3b82f6; }

/* ===== DYNAMIC LIST ITEMS (CPL, CPMK, etc) ===== */
.dyn-item {
    background: #fafbfc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    display: grid;
    grid-template-columns: 110px 1fr auto;
    gap: 10px;
    align-items: start;
}
.dyn-item .form-control { background: white; }
.dyn-item .remove-btn {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
    width: 32px; height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    display: grid; place-items: center;
}
.dyn-item .remove-btn:hover { background: var(--danger); color: white; }

.dyn-sub-item {
    grid-template-columns: 110px 110px 1fr auto;
}

.dyn-add-btn {
    width: 100%;
    padding: 12px;
    background: white;
    border: 2px dashed var(--border);
    color: var(--primary);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all .15s;
}
.dyn-add-btn:hover {
    background: rgba(30,64,175,.04);
    border-color: var(--primary);
}

/* ===== RPS PREVIEW (print) ===== */
.rps-preview {
    background: white;
    padding: 50px;
    max-width: 1200px;
    margin: 0 auto;
    box-shadow: var(--shadow);
    border-radius: 6px;
}
.rps-preview table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
    font-size: 11pt;
}
.rps-preview table, .rps-preview th, .rps-preview td {
    border: 1px solid #000;
}
.rps-preview th, .rps-preview td {
    padding: 6px 8px;
    text-align: left;
    vertical-align: top;
}
.rps-preview th { background: #f3f4f6; font-weight: 700; }
.rps-preview .header-cell {
    text-align: center;
    font-weight: 700;
    background: #f9fafb;
}
.rps-preview h2.rps-title { text-align: center; font-size: 14pt; margin: 0 0 8px; }
.rps-preview h3 { font-size: 12pt; margin: 18px 0 8px; }

@media print {
    body { background: white; }
    .sidebar, .topbar, .no-print { display: none !important; }
    .layout { grid-template-columns: 1fr; }
    .content { padding: 0; }
    .rps-preview { box-shadow: none; padding: 20px; max-width: 100%; }
    .rps-preview table { font-size: 10pt; page-break-inside: auto; }
    .rps-preview tr { page-break-inside: avoid; }
}

/* ===== CHECKBOXES METODE ===== */
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all .15s;
}
.checkbox-group label:hover { border-color: var(--primary-light); }
.checkbox-group label.checked {
    border-color: var(--primary);
    background: rgba(30,64,175,.04);
}
.checkbox-group input { accent-color: var(--primary); }

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
    overflow-x: auto;
}
.tab {
    padding: 12px 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-size: 13px;
    white-space: nowrap;
    transition: all .12s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state .ico {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: .5;
}

/* Action bar */
.actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 16px 0;
    flex-wrap: wrap;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h2 { font-size: 22px; margin: 0; font-weight: 700; }
.page-header .breadcrumb { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.page-header .breadcrumb a { color: var(--primary); text-decoration: none; }
