/* =========================================
   1. GLOBAL & RESET
   ========================================= */
:root {
    /* Color Palette Modern */
    --primary-color: #4361ee;
    --primary-hover: #3a56d4;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #0ea5e9;
    
    /* Backgrounds */
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --input-bg: #f9fafb;
    
    /* Text & Borders */
    --text-dark: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    
    /* UI Properties */
    --radius: 8px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

body { 
    font-family: 'Poppins', 'Inter', sans-serif;
    margin: 0; 
    padding: 0; 
    background-color: var(--bg-color); 
    color: var(--text-dark);
    font-size: 14px;
}

/* =========================================
   2. LOGIN PAGE STYLES
   ========================================= */
.login-body {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-wrapper {
    background: #ffffff;
    width: 100%;
    max-width: 400px;
    padding: 50px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    text-align: center;
    position: relative;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-header { margin-bottom: 40px; }

.icon-circle {
    width: 80px; height: 80px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white; font-size: 36px; border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    margin: 0 auto 20px; box-shadow: 0 10px 20px rgba(52, 152, 219, 0.3);
}

.login-header h2 { 
    margin: 0; 
    color: #2c3e50; 
    font-weight: 700; 
    font-size: 24px; 
    letter-spacing: 0.5px;
    /* Reset Global H2 Styles */
    border-bottom: none; 
    padding-bottom: 0;
    text-align: center;
}
.login-header p { margin: 10px 0 0; color: #95a5a6; font-size: 14px; }

/* Login Inputs (High Specificity) */
.input-group { position: relative; margin-bottom: 25px; }
.input-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: #bdc3c7; font-size: 18px; transition: 0.3s; z-index: 2; }

.input-group input { 
    width: 100%; 
    padding: 15px 20px 15px 55px; 
    border: 2px solid #ecf0f1; 
    border-radius: 12px; 
    outline: none; 
    font-size: 15px; 
    transition: all 0.3s ease; 
    box-sizing: border-box; 
    background: #fdfdfd; 
    color: #34495e; 
    height: auto; /* Reset height override */
    margin: 0;
}
.input-group input:focus { border-color: #3498db; background: #fff; box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1); }
.input-group input:focus + .input-icon { color: #3498db; }

.btn-login { width: 100%; padding: 15px; background: linear-gradient(to right, #3498db, #2980b9); color: white; border: none; border-radius: 12px; font-size: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; cursor: pointer; transition: all 0.3s ease; margin-top: 15px; box-shadow: 0 10px 20px rgba(52, 152, 219, 0.3); }
.btn-login:hover { transform: translateY(-3px); box-shadow: 0 15px 30px rgba(52, 152, 219, 0.4); background: linear-gradient(to right, #2980b9, #3498db); }
.btn-login:active { transform: translateY(-1px); }

.alert-error { background: #e74c3c; color: white; padding: 15px; border-radius: 10px; font-size: 14px; margin-bottom: 30px; display: flex; align-items: center; justify-content: center; gap: 10px; box-shadow: 0 5px 15px rgba(231, 76, 60, 0.3); animation: shake 0.5s ease-in-out; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); } 20%, 40%, 60%, 80% { transform: translateX(5px); } }
.login-footer { margin-top: 40px; font-size: 13px; color: #bdc3c7; border-top: 1px solid #ecf0f1; padding-top: 25px; }


/* =========================================
   3. LAYOUT UTAMA (DASHBOARD & ADMIN)
   ========================================= */
.top-header { 
    background: linear-gradient(to right, #2c3e50, #34495e); 
    color: #fff; 
    padding: 0 30px; 
    height: 70px; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
    position: sticky; 
    top: 0; 
    z-index: 1000; 
}

.main-content { 
    width: 90%;               
    max-width: 90%;        
    margin: 30px auto;        
    background: #ffffff;      
    min-height: 500px; 
    padding: 30px; 
    border-radius: 15px;      
    box-shadow: 0 5px 25px rgba(0,0,0,0.05); 
    box-sizing: border-box;
}

/* =========================================
   4. MENU NAVIGASI
   ========================================= */
.top-menu { display: flex; align-items: center; gap: 10px; overflow-x: auto; }
.top-menu a { color: rgba(255,255,255,0.85); text-decoration: none; margin: 0; padding: 10px 15px; font-size: 14px; font-weight: 500; border-radius: 6px; transition: all 0.3s ease; display: flex; align-items: center; gap: 8px; }
.top-menu a:hover, .top-menu a.active { color: #fff; background-color: rgba(255,255,255,0.15); text-decoration: none; transform: translateY(-2px); }
.top-menu i { font-size: 16px; }

.logout-btn { background: #ef4444 !important; color: white !important; padding: 8px 20px !important; margin-left: 15px !important; border-radius: 6px !important; font-weight: 600 !important; box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3); }
.logout-btn:hover { background: #dc2626 !important; box-shadow: 0 6px 15px rgba(239, 68, 68, 0.4); }

/* =========================================
   5. TYPOGRAPHY (GLOBAL)
   ========================================= */
h2 { 
    color: #2c3e50; 
    margin-bottom: 25px; 
    font-weight: 700; 
    font-size: 1.5rem; 
    letter-spacing: -0.025em; 
    border-bottom: 2px solid #f1f2f6; 
    padding-bottom: 15px;
}

h3 { color: var(--text-dark); margin-bottom: 15px; }

h4 {
    font-weight: 600;
    color: #444;
    margin-bottom: 1rem;
    margin-top: 1.5rem;
    font-size: 1rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    display: inline-block;
}

p.subtitle { color: var(--text-muted); margin-top: 0; margin-bottom: 25px; font-size: 14px; }

/* =========================================
   6. MODERN CARD & CONTAINERS
   ========================================= */
.modern-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid #e5e7eb;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.card-header { 
    display: flex; justify-content: space-between; align-items: center; 
    margin-bottom: 20px; border-bottom: 1px solid #f3f4f6; padding-bottom: 10px; 
}
.card-header h4 { margin: 0; font-size: 16px; font-weight: 600; color: #374151; border: none; padding: 0; }

/* =========================================
   7. FORMS & INPUTS
   ========================================= */
label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #333;
}

/* Style dasar untuk input (Dashboard / App) */
input.form-input, 
select.form-input, 
textarea.form-input, 
.input-view,
/* Backward Compatibility */
.form-input input[type="text"],
.form-input input[type="number"],
.form-input input[type="date"],
.form-input input[type="password"],
.form-input select,
.form-input textarea {
    display: block;
    width: 100%;
    height: 42px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: var(--input-bg);
    color: var(--text-dark);
    transition: all 0.2s ease;
    box-sizing: border-box;
    margin: 0;
    font-family: inherit;
    box-shadow: none;
}

input.form-input:focus, 
select.form-input:focus, 
textarea.form-input:focus,
.form-input input:focus,
.form-input select:focus,
.form-input textarea:focus {
    border-color: var(--primary-color);
    background-color: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

textarea.form-input, textarea.input-view, .form-input textarea {
    height: auto !important;
    padding: 12px;
    font-family: inherit;
}

.input-disabled, .input-view[readonly], input[readonly] {
    background-color: #e9ecef !important;
    color: #6b7280 !important;
    cursor: not-allowed;
    border-color: #d1d5db !important;
}

/* =========================================
   8. BUTTONS
   ========================================= */
.btn-action {
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    text-decoration: none;
    white-space: nowrap;
    margin: 0;
    font-family: inherit;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.btn-action:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.15); }

.btn-primary { background-color: var(--primary-color); color: white; }
.btn-success { background-color: #27ae60; color: white; }
.btn-secondary { background-color: var(--secondary-color); color: white; }
.btn-info { background-color: var(--info-color); color: white; }
.btn-danger { background-color: var(--danger-color); color: white; }

/* Tombol Hapus Item (Merah Kecil) */
.btn-delete-row {
    background-color: #ef4444;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
    margin: 0;
}
.btn-delete-row:hover { background-color: #dc2626; transform: scale(1.05); }

/* Small Icon Buttons (Table Actions) */
.btn-icon {
    width: 32px; height: 32px;
    display: inline-flex;
    align-items: center; justify-content: center;
    border-radius: 6px; color: white; text-decoration: none;
    transition: transform 0.2s; margin-right: 5px; font-size: 14px;
}
.btn-icon:hover { transform: scale(1.1); }
.btn-icon.edit { background-color: var(--warning-color); }
.btn-icon.success { background-color: var(--success-color); }
.btn-icon.danger { background-color: var(--danger-color); }
.btn-icon.primary { background-color: var(--primary-color); }

.btn-pilih-modal {
    background-color: var(--primary-color); color: white; border: none;
    padding: 6px 12px; border-radius: 6px; cursor: pointer;
    font-size: 12px; font-weight: 500; transition: background 0.2s;
}
.btn-pilih-modal:hover { background-color: var(--primary-hover); }

.btn-small {
    font-size: 12px; text-decoration: none; color: var(--primary-color); font-weight: 600;
}
.btn-small:hover { text-decoration: underline; }

.btn-camera {
    background: var(--info-color); color: white; 
    padding: 6px 12px; border-radius: 6px; border: none; 
    cursor: pointer; font-size: 12px;
    display: inline-flex; align-items: center; gap: 5px; 
    transition: background 0.2s;
}

/* =========================================
   9. TABLES
   ========================================= */
.table-modern {
    width: 100%; border-collapse: separate; border-spacing: 0;
    margin: 0; padding: 0; background: #fff; border-radius: 8px; overflow: hidden;
    border: 1px solid #eee; margin-bottom: 15px; font-size: 14px;
}
.table-modern th {
    background-color: #f8f9fa; color: #2c3e50; font-weight: 600;
    padding: 12px 15px; text-align: left; font-size: 14px; border-bottom: 2px solid #eee;
    vertical-align: middle; white-space: nowrap;
}
.table-modern td {
    padding: 10px 15px; border-bottom: 1px solid #f1f2f6;
    font-size: 14px; color: #555; vertical-align: middle;
}
.table-modern tr:last-child td { border-bottom: none; }
.table-modern tr:hover td { background-color: #fcfcfc; }

/* Dashboard Table */
.table-dash { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-dash th { text-align: left; padding: 10px; color: #6b7280; font-weight: 600; background: #f9fafb; }
.table-dash td { padding: 12px 10px; border-bottom: 1px solid #f3f4f6; color: #1f2937; }
.table-dash tr:last-child td { border-bottom: none; }

.text-truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; display: block; }
.text-nowrap { white-space: nowrap; }

/* =========================================
   10. BADGES & STATUS
   ========================================= */
.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; display: inline-block; white-space: nowrap;}
.status-baru { background-color: #dbeafe; color: #1e40af; }
.status-proses { background-color: #ffedd5; color: #9a3412; }
.status-selesai { background-color: #d1fae5; color: #065f46; }

.badge { padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-process { background: #fff7ed; color: #c2410c; }
.badge-new { background: #eff6ff; color: #1d4ed8; }
.badge-done { background: #ecfdf5; color: #047857; }

/* =========================================
   11. MODALS
   ========================================= */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(17, 24, 39, 0.6); 
    display: none; justify-content: center; align-items: center;
    z-index: 1050; backdrop-filter: blur(3px);
}
.modal-content {
    background: #ffffff; padding: 25px; border-radius: 12px;
    width: 90%; max-width: 600px; max-height: 90vh; overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    position: relative; animation: modalFadeIn 0.3s ease-out;
    border: 1px solid #eee;
}
@keyframes modalFadeIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid #eee; }
.modal-header h3 { margin: 0; font-size: 1.25rem; color: #333; }
.close-modal { position: absolute; top: 20px; right: 25px; font-size: 24px; color: #999; cursor: pointer; transition: color 0.2s; line-height: 1; }
.close-modal:hover { color: var(--danger-color); }

.modal-search {
    width: 100%; height: 45px; padding: 10px 15px; margin-bottom: 20px;
    border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s; box-sizing: border-box;
}
.modal-search:focus {
    border-color: var(--primary-color); outline: none;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

/* =========================================
   12. COMPONENTS (Pagination, Grid, etc)
   ========================================= */
.pagination { display: flex; gap: 4px; }
.page-link {
    width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
    border-radius: 6px; border: 1px solid #ddd; background: white; color: var(--text-dark);
    text-decoration: none; font-size: 14px; transition: all 0.2s;
}
.page-link:hover, .page-link.active { background-color: var(--primary-color); color: white; border-color: var(--primary-color); }
.page-link.disabled { background-color: #f3f4f6; color: #9ca3af; pointer-events: none; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
@media (max-width: 768px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* Dashboard Stats Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 25px; }
.stat-card {
    background: var(--card-bg); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-md);
    display: flex; align-items: center; transition: transform 0.2s; border-left: 4px solid transparent;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-icon {
    width: 50px; height: 50px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
    font-size: 24px; margin-right: 15px; color: white;
}
.stat-info h3 { margin: 0; font-size: 24px; font-weight: 700; color: var(--text-dark); }
.stat-info p { margin: 0; font-size: 13px; color: var(--text-muted); font-weight: 500; }

.card-blue { border-left-color: #4361ee; } .card-blue .stat-icon { background: linear-gradient(135deg, #4361ee, #3a0ca3); }
.card-green { border-left-color: #10b981; } .card-green .stat-icon { background: linear-gradient(135deg, #10b981, #059669); }
.card-orange { border-left-color: #f59e0b; } .card-orange .stat-icon { background: linear-gradient(135deg, #f59e0b, #d97706); }
.card-purple { border-left-color: #8b5cf6; } .card-purple .stat-icon { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }

.dashboard-content { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
@media (max-width: 992px) { .dashboard-content { grid-template-columns: 1fr; } }

/* =========================================
   13. SPECIAL INPUTS (Signature, Checkbox, Radio)
   ========================================= */
.signature-area {
    border: 2px dashed #cbd5e1; border-radius: var(--radius);
    background-color: #f8fafc; position: relative;
    height: 150px; display: flex; justify-content: center; align-items: center; overflow: hidden;
    cursor: crosshair;
}
.signature-placeholder {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    color: #94a3b8; pointer-events: none; font-size: 0.9rem; font-weight: 600;
}
.signature-img { max-width: 100%; max-height: 100%; }

.img-preview-box {
    width: 80px; height: 80px; background: #f3f4f6; 
    border: 1px solid #d1d5db; border-radius: var(--radius);
    display: flex; justify-content: center; align-items: center; 
    margin-top: 8px; overflow: hidden;
}
.img-preview-box img { width: 100%; height: 100%; object-fit: cover; }

/* Checklist Radio Custom */
.table-modern.table-checklist td.chk-cell {
    width: 60px !important; height: 50px !important; padding: 0 !important; position: relative !important;
}
.radio-hitbox {
    position: absolute !important; top: 0; left: 0; width: 100% !important; height: 100% !important;
    display: flex !important; justify-content: center !important; align-items: center !important;      
    margin: 0 !important; padding: 0 !important; z-index: 1; cursor: pointer;
}
.radio-hitbox:hover { background-color: #eff6ff; }
.radio-hitbox input[type="radio"] {
    margin: 0 !important; padding: 0 !important; display: block !important; 
    width: 18px; height: 18px; transform: scale(1.3); position: static !important; cursor: pointer;
}

/* Kesimpulan Grid */
.kesimpulan-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
.kesimpulan-item {
    display: flex; align-items: center; gap: 8px; padding: 10px;
    border-radius: var(--radius); background-color: #f9fafb; border: 1px solid transparent; cursor: pointer;
}
.kesimpulan-item:hover, .kesimpulan-item.active { background-color: #ffffff; border-color: #d1d5db; box-shadow: var(--shadow-sm); }

/* Checkbox Grid (Role) */
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; background: #f9fafb; padding: 15px; border-radius: 8px; border: 1px solid #e5e7eb; }
.checkbox-item {
    display: flex; align-items: center; background: #ffffff; padding: 8px 12px;
    border: 1px solid #e5e7eb; border-radius: 6px; cursor: pointer; transition: all 0.2s; font-size: 0.9rem;
}
.checkbox-item:hover { border-color: var(--primary-color); background: #eff6ff; }
.checkbox-item input { margin-right: 8px; transform: scale(1.2); }

/* Icon Picker */
.icon-picker-container { border: 1px solid #ccc; border-radius: 6px; padding: 10px; background: #f9fafb; margin-top: 5px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 8px; max-height: 200px; overflow-y: auto; }
.icon-item { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid #ddd; border-radius: 6px; background: white; cursor: pointer; transition: all 0.2s; font-size: 16px; color: #555; }
.icon-item:hover { background-color: #eff6ff; border-color: var(--primary-color); color: var(--primary-color); transform: scale(1.05); }
.icon-item.selected { background-color: var(--primary-color); border-color: var(--primary-color); color: white; }
.icon-preview-box { display: flex; justify-content: center; align-items: center; width: 42px; height: 42px; background: #f3f4f6; border: 1px solid #d1d5db; border-radius: 8px; color: var(--text-dark); font-size: 18px; }

/* Table Scroll Container */
.table-scroll { max-height: 50vh; overflow-y: auto; border: 1px solid #e5e7eb; border-radius: 8px; }

/* Print */
@media print {
    body * { visibility: hidden; }
    #printableArea, #printableArea * { visibility: visible; }
    #printableArea { position: absolute; left: 0; top: 0; width: 100%; }
    .no-print { display: none !important; }
}