/* style.css - Premium Modern Design & Print Stylesheet */

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

:root {
    --primary-gradient: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
    --accent-gradient: linear-gradient(135deg, #1d976c, #93f9b9);
    --danger-gradient: linear-gradient(135deg, #eb3941, #f15e64);
    --warning-gradient: linear-gradient(135deg, #f2994a, #f2c94c);
    
    --bg-dark: #0f172a;
    --bg-light: #f8fafc;
    --card-bg-light: rgba(255, 255, 255, 0.85);
    --card-bg-dark: rgba(15, 23, 42, 0.8);
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #f8fafc;
    
    --primary-color: #0f2027;
    --primary-hover: #1b2e35;
    
    --border-color: #e2e8f0;
    --focus-ring: 0 0 0 3px rgba(32, 58, 67, 0.25);
    
    --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);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Sarabun', 'Outfit', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Glassmorphism Background Decoration */
.bg-decor {
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(32, 58, 67, 0.15) 0%, rgba(255,255,255,0) 70%);
    filter: blur(40px);
    z-index: -1;
}
.bg-decor-1 { top: -50px; right: -50px; }
.bg-decor-2 { bottom: -50px; left: -50px; }

/* Auth Layout */
.auth-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    background: radial-gradient(circle at 10% 20%, rgba(15, 32, 39, 0.05) 0%, rgba(44, 83, 100, 0.05) 90.1%);
}

.auth-card {
    background: var(--card-bg-light);
    border: 1px solid rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-xl);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.auth-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 30px 40px -10px rgba(0, 0, 0, 0.15);
}

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

.auth-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
    object-fit: contain;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

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

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

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

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.9);
    outline: none;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: var(--focus-ring);
    background-color: #fff;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.form-check-input {
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: var(--text-light);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    opacity: 0.95;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-success {
    background: var(--accent-gradient);
    color: #0c3e26;
    box-shadow: var(--shadow-sm);
}

.btn-success:hover {
    opacity: 0.95;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: var(--danger-gradient);
    color: var(--text-light);
}

.btn-danger:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    background-color: #cbd5e1;
}

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

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
}

.alert-danger {
    background-color: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

.alert-success {
    background-color: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

/* Navigation Header */
.navbar {
    background: var(--primary-gradient);
    color: var(--text-light);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-md);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.25rem;
    text-decoration: none;
    color: inherit;
}

.navbar-brand img {
    height: 40px;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-info {
    text-align: right;
    font-size: 0.9rem;
}

.user-name {
    font-weight: 600;
    display: block;
}

.user-role {
    font-size: 0.75rem;
    opacity: 0.8;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 0.1rem 0.5rem;
    border-radius: 20px;
}

/* Main Container Layout */
.container {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* Grid & Cards Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Stats Widget */
.stat-card {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

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

.stat-details h3 {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-details p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Form Sections */
.form-section {
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.form-section-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .form-row-2 { grid-template-columns: repeat(2, 1fr); }
    .form-row-3 { grid-template-columns: repeat(3, 1fr); }
    .form-row-4 { grid-template-columns: repeat(4, 1fr); }
}

/* Tables Styling */
.table-responsive {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

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

.table th {
    background-color: var(--bg-light);
    color: var(--text-primary);
    font-weight: 600;
    padding: 1rem;
    border-bottom: 2px solid var(--border-color);
}

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

.table tbody tr:nth-child(even) {
    background-color: rgba(248, 250, 252, 0.5);
}

.table tbody tr:hover {
    background-color: rgba(241, 245, 249, 0.8);
}

/* Badges */
.badge {
    display: inline-flex;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
}

.badge-pending {
    background-color: #fef3c7;
    color: #d97706;
}

.badge-approved {
    background-color: #dcfce7;
    color: #15803d;
}

.badge-rejected {
    background-color: #fee2e2;
    color: #b91c1c;
}

/* Utility layout */
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-gap-1 {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.text-center { text-align: center; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }
.mt-4 { margin-top: 2rem; }

/* Print Stylesheet (Critical for A4 Layout) */
@media print {
    body {
        background-color: #fff !important;
        color: #000 !important;
        font-size: 12pt !important;
        line-height: 1.5 !important;
    }
    
    .navbar, .btn, .no-print, .bg-decor {
        display: none !important;
    }
    
    .container {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .print-doc {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
    }

    .print-title {
        font-size: 16pt !important;
        font-weight: bold !important;
        text-align: center !important;
        margin-bottom: 1.5rem !important;
    }

    .print-subtitle {
        font-size: 14pt !important;
        text-align: center !important;
        margin-bottom: 2rem !important;
    }

    .print-row {
        margin-bottom: 1.25rem !important;
        display: flex !important;
        flex-wrap: wrap !important;
    }

    .print-line-fill {
        border-bottom: 1px dotted #000 !important;
        flex-grow: 1 !important;
        margin-left: 5px !important;
        margin-right: 5px !important;
        padding-left: 5px !important;
        min-height: 1.5rem !important;
        display: inline-block !important;
    }

    .print-section-header {
        font-size: 13pt !important;
        font-weight: bold !important;
        margin-top: 1.5rem !important;
        margin-bottom: 0.75rem !important;
        border-bottom: 1px solid #000 !important;
        padding-bottom: 3px !important;
    }
    
    /* Ensure page breaks don't ruin layout */
    .print-page {
        page-break-after: always;
    }
}
