/* Modern Vanilla CSS for FleetSchool */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --color-primary: #4f46e5;
    --color-primary-hover: #4338ca;
    --color-primary-light: #e0e7ff;
    
    --color-secondary: #06b6d4;
    --color-secondary-hover: #0891b2;
    
    --color-success: #10b981;
    --color-success-bg: #ecfdf5;
    --color-success-text: #065f46;
    
    --color-warning: #f59e0b;
    --color-warning-bg: #fffbeb;
    --color-warning-text: #92400e;
    
    --color-danger: #ef4444;
    --color-danger-bg: #fef2f2;
    --color-danger-text: #991b1b;
    
    --border-color: #e2e8f0;
    --border-focus: #a5b4fc;
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.03), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
    --hover-shadow: 0 20px 25px -5px rgba(79, 70, 229, 0.08), 0 10px 10px -6px rgba(79, 70, 229, 0.04);
    
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.5);
    --sidebar-width: 280px;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* App Wrapper for Dashboard Layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar Navigation */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    padding-left: 0.5rem;
}

.logo-icon {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.25rem;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.logo-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(to right, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text p {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-link:hover {
    background-color: var(--bg-primary);
    color: var(--color-primary);
    transform: translateX(4px);
}

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

.sidebar-link svg {
    width: 20px;
    height: 20px;
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-top: auto;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--color-primary);
}

.user-info h4 {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.user-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-danger);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 1rem;
    padding: 0.5rem;
    transition: opacity 0.2s;
}

.logout-btn:hover {
    opacity: 0.8;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    padding: 2.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

.page-title h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-title p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Grid Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.stat-info h3 {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 0.5rem;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--text-primary), #475569);
    -webkit-background-clip: text;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.primary {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
}

.stat-icon.success {
    background-color: var(--color-success-bg);
    color: var(--color-success);
}

.stat-icon.warning {
    background-color: var(--color-warning-bg);
    color: var(--color-warning);
}

.stat-icon.danger {
    background-color: var(--color-danger-bg);
    color: var(--color-danger);
}

/* Content Layout (Form vs Table) */
.content-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .content-grid.split {
        grid-template-columns: 2fr 1fr;
    }
}

.card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    padding: 1.75rem;
    margin-bottom: 2rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

/* Elegant Form Styling */
.form-group {
    margin-bottom: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    background-color: var(--bg-secondary);
    box-shadow: 0 0 0 3px var(--border-focus);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2em;
    padding-right: 2.5rem;
}

/* Custom Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
    color: white;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
    background-color: #e2e8f0;
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background-color: #cbd5e1;
    color: var(--text-primary);
}

.btn-success {
    background-color: var(--color-success);
    color: white;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background-color: #0d9488;
    transform: translateY(-2px);
}

.btn-danger {
    background-color: var(--color-danger);
    color: white;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2);
}

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

.btn-sm {
    padding: 0.5rem 0.875rem;
    font-size: 0.85rem;
}

/* Elegant Table Design */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

th {
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

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

/* Custom Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-pending {
    background-color: var(--color-warning-bg);
    color: var(--color-warning-text);
}

.badge-approved {
    background-color: var(--color-success-bg);
    color: var(--color-success-text);
}

.badge-rejected {
    background-color: var(--color-danger-bg);
    color: var(--color-danger-text);
}

.badge-completed {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
}

.badge-maintenance {
    background-color: #f1f5f9;
    color: #475569;
}

/* Flash Messages Alert style */
.alerts-container {
    margin-bottom: 1.5rem;
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.alert-success {
    background-color: var(--color-success-bg);
    color: var(--color-success-text);
    border-left: 4px solid var(--color-success);
}

.alert-danger {
    background-color: var(--color-danger-bg);
    color: var(--color-danger-text);
    border-left: 4px solid var(--color-danger);
}

.alert-warning {
    background-color: var(--color-warning-bg);
    color: var(--color-warning-text);
    border-left: 4px solid var(--color-warning);
}

/* Login Page Layout */
.login-body {
    background: radial-gradient(circle at 10% 20%, rgba(98, 114, 246, 0.1) 0%, rgba(204, 251, 241, 0.1) 90.2%);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

.login-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 440px;
    padding: 2.5rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    display: inline-flex;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 8px 16px rgba(79, 70, 229, 0.3);
}

.login-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.login-header p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Modal Popup standard */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

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

.modal-container {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 550px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

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

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* QR Code & Printable Letter styling */
.surat-tugas-container {
    background: white;
    color: black;
    max-width: 800px;
    margin: 2rem auto;
    padding: 3rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #d1d5db;
    border-radius: 4px;
}

.kop-surat {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    border-bottom: 4px double black;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.kop-logo {
    width: 80px;
    height: 80px;
    background: #1e293b;
    border-radius: 8px;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px;
}

.kop-detail h2 {
    font-size: 1.35rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kop-detail h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #475569;
    margin-top: 0.15rem;
}

.kop-detail p {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.25rem;
    line-height: 1.3;
}

.surat-title {
    text-align: center;
    margin-bottom: 2.5rem;
}

.surat-title h2 {
    font-size: 1.25rem;
    text-transform: uppercase;
    text-decoration: underline;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.surat-title p {
    font-size: 0.9rem;
    margin-top: 0.25rem;
    color: #334155;
}

.surat-content {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 2.5rem;
}

.surat-table {
    width: 100%;
    margin: 1.5rem 0;
    border-collapse: collapse;
}

.surat-table td {
    padding: 0.5rem 0;
    border-bottom: none;
    color: black;
}

.surat-table td:first-child {
    width: 200px;
    font-weight: 600;
}

.surat-table td:nth-child(2) {
    width: 20px;
}

.surat-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 3.5rem;
}

.qr-verification {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 130px;
    background-color: #f8fafc;
}

.qr-placeholder {
    width: 80px;
    height: 80px;
    background: linear-gradient(45deg, #111 25%, transparent 25%), 
                linear-gradient(-45deg, #111 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #111 75%), 
                linear-gradient(-45deg, transparent 75%, #111 75%);
    background-size: 10px 10px;
    background-position: 0 0, 0 5px, 5px -5px, -5px 0px;
    border: 2px solid black;
    border-radius: 4px;
}

.qr-text {
    font-size: 0.65rem;
    color: #64748b;
    text-align: center;
    font-weight: 600;
}

.signature-block {
    text-align: center;
    width: 250px;
}

.signature-space {
    height: 75px;
}

.signature-name {
    font-weight: 700;
    text-decoration: underline;
}

.signature-title {
    font-size: 0.85rem;
    color: #475569;
}

/* Action button bar for preview screen */
.action-bar-print {
    max-width: 800px;
    margin: 1.5rem auto 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
}

/* Print-only CSS helpers */
.print-only {
    display: none;
}

/* Print CSS Configurations */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    .no-print {
        display: none !important;
    }
    .print-only {
        display: inline !important;
    }
    .surat-tugas-container {
        border: none !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    .qr-verification {
        background-color: white !important;
        border: 1px solid #bbb !important;
    }
}
