@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');

:root {
    --primary-color: #059669;
    --primary-hover: #047857;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --border-color: #e2e8f0;
    --nav-bg: rgba(39, 49, 72, 0.95);
    --bg-color: #f4f7f6;
    --text-main: #1e293b;
    --text-light: #64748b;
}

* { 
    box-sizing: border-box; 
    scroll-behavior: smooth; 
}

html { 
    scroll-padding-top: 70px; 
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Navbar & Menus */
.navbar {
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 10px 4%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--primary-color);
    min-height: 65px;
    transition: transform 0.3s ease-in-out;
}

.hamburger {
    display: none;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.hamburger:hover { 
    background: rgba(255, 255, 255, 0.2); 
}

.side-menu {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100vh;
    background: var(--nav-bg);
    backdrop-filter: blur(15px);
    z-index: 1100;
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    border-left: 3px solid var(--primary-color);
    overflow-y: auto;
}

html[dir="ltr"] .side-menu {
    right: auto;
    left: -300px;
    border-left: none;
    border-right: 3px solid var(--primary-color);
}

.side-menu.open { right: 0; }
html[dir="ltr"] .side-menu.open { right: auto; left: 0; }

.close-btn {
    align-self: flex-end;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    margin-bottom: 20px;
    transition: color 0.2s ease;
}

.close-btn:hover { color: var(--primary-color); }

.side-links { display: flex; flex-direction: column; gap: 15px; }

.side-links a, .side-links button {
    color: #f8fafc;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    padding: 12px 15px;
    border-radius: 8px;
    transition: all 0.2s ease;
    text-align: right;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    cursor: pointer;
}

html[dir="ltr"] .side-links a, html[dir="ltr"] .side-links button { text-align: left; }
.side-links a:hover, .side-links button:hover { background: rgba(255, 255, 255, 0.1); transform: translateX(-5px); }
html[dir="ltr"] .side-links a:hover, html[dir="ltr"] .side-links button:hover { transform: translateX(5px); }

.nav-brand { display: flex; align-items: center; text-decoration: none; }
.brand-logo, .global-logo { max-height: 45px; width: auto; }
.nav-links { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.nav-links a, .nav-links button { color: #f8fafc; text-decoration: none; font-weight: 700; font-size: 0.9rem; white-space: nowrap; }
.nav-text { display: flex !important; align-items: center; gap: 4px; }
.staff-links { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Buttons */
.btn-primary, button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 11px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    min-height: 44px;
    font-family: inherit;
}

.btn-primary:hover, button:hover { 
    background-color: var(--primary-hover); 
    transform: translateY(-1px); 
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3); 
}
.btn-primary:active { transform: translateY(0); }

.btn-outline { background: transparent; border: 2px solid var(--primary-color); color: var(--primary-color); }
.btn-outline:hover { background: var(--primary-color); color: white; }

.btn-register { background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.3); color: white; padding: 8px 14px; border-radius: 6px; cursor: pointer; font-size: 0.85rem; transition: all 0.2s ease; }
.btn-register:hover { background: rgba(255, 255, 255, 0.15); }

/* Layout & Containers */
.landing-wrapper, .portal-container { max-width: 1200px; margin: 0 auto; padding: 80px 15px 30px; }

.hero-text { margin-bottom: 40px; }
.hero-text h1 { font-size: 2.2rem; color: var(--text-main); margin: 0 0 15px 0; line-height: 1.3; }
.hero-text p { font-size: 1.05rem; color: var(--text-light); margin-bottom: 20px; }

.booking-section, .report-box { background: #fff; padding: 28px; border-radius: 14px; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.03); margin-bottom: 2rem; border: 1px solid rgba(0, 0, 0, 0.05); }

/* Forms */
.input-group { margin-bottom: 1.3rem; position: relative; }
.input-group label { display: block; margin-bottom: 0.6rem; font-weight: 700; color: var(--text-light); font-size: 0.95rem; }
.input-group input, .input-group select, .input-group textarea { width: 100%; padding: 12px 14px; border: 2px solid var(--border-color); border-radius: 8px; font-weight: 600; background: #f8fafc; color: var(--text-main); font-size: 1rem; font-family: inherit; transition: all 0.2s ease; }
.input-group input:focus, .input-group select:focus, .input-group textarea:focus { border-color: var(--primary-color); outline: none; background: #fff; box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1); }
.input-group input::placeholder, .input-group textarea::placeholder { color: #cbd5e1; }

/* Admin Dashboard */
.admin-grid { display: grid; grid-template-columns: 260px 1fr; min-height: calc(100vh - 70px); margin-top: 70px; }
.sidebar { background: #fff; border-left: 1px solid var(--border-color); padding: 20px; position: sticky; top: 70px; height: calc(100vh - 70px); overflow-y: auto; }
html[dir="ltr"] .sidebar { border-left: none; border-right: 1px solid var(--border-color); }

.sidebar-nav { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; margin: 0; }
.sidebar-nav li { padding: 10px 12px; border-radius: 8px; cursor: pointer; font-weight: 700; color: var(--text-light); transition: all 0.2s ease; font-size: 0.9rem; }
.sidebar-nav li:hover { color: var(--primary-color); background: #f1f5f9; }
.sidebar-nav li:active { background: #e0f2fe; }
.sidebar-nav button { width: 100%; justify-content: flex-start; }

.content-area { padding: 25px; width: 100%; overflow-y: auto; }

/* Data Tables */
.data-table { width: 100%; border-collapse: collapse; margin-top: 20px; background: white; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02); }
.data-table th, .data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border-color); text-align: start; font-size: 0.9rem; }
.data-table th { background: #f8fafc; font-weight: 800; color: var(--text-light); }
.data-table tr:hover { background: #f8fafc; }

/* Utilities */
.hidden { display: none !important; }

/* Badges */
.status-badge { padding: 6px 12px; border-radius: 20px; font-size: 0.8rem; font-weight: bold; display: inline-block; }
.role-badge { padding: 6px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: bold; display: inline-block; text-transform: capitalize; }
.role-worker { background: #e0f2fe; color: #0369a1; }
.role-supervisor { background: #fef08a; color: #854d0e; }
.role-admin { background: #fed7aa; color: #9a3412; }
.time-badge { background: #e2e8f0; padding: 6px 10px; border-radius: 5px; font-weight: bold; font-size: 0.85rem; color: var(--text-main); display: inline-block; }

.hide-on-mobile { display: block; }

/* Toasts */
.toast { position: fixed; bottom: 20px; left: 20px; right: 20px; background: #10b981; color: white; padding: 14px 18px; border-radius: 8px; box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); z-index: 2000; animation: slideIn 0.3s ease; max-width: 400px; margin-left: auto; font-weight: 600; }
.toast.error { background: #ef4444; }
.toast.warning { background: #f59e0b; }
@keyframes slideIn { from { transform: translateY(100px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
#toast-container { position: fixed; bottom: 0; left: 0; right: 0; pointer-events: none; z-index: 2000; }

/* Worker Portal Specifics */
.draft-mode { border: 2px dashed var(--warning); padding: 18px; border-radius: 10px; background: rgba(245, 158, 11, 0.03); }
.submitted-mode { opacity: 0.7; pointer-events: none; border: 2px solid var(--success); }
.preview-img { width: 70px; height: 70px; object-fit: cover; border-radius: 6px; border: 2px solid var(--primary-color); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }

/* Signature Canvas */
.signature-pad { 
    border: 2px dashed var(--primary-color); 
    border-radius: 8px; 
    background: #fff; 
    width: 100%; 
    height: 150px; 
    touch-action: none; 
    cursor: crosshair; 
}

/* Print Styles */
@media print { 
    .hide-on-print, .navbar, .side-menu, button { display: none !important; } 
    body { background: white; }
    .portal-container, .admin-grid { padding: 0; margin: 0; box-shadow: none; }
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
    .admin-grid { grid-template-columns: 1fr; min-height: auto; }
}

@media (max-width: 768px) {
    .sidebar { display: none !important; }
    .navbar { padding: 8px 12px; min-height: 60px; flex-wrap: wrap; gap: 8px; }
    .hamburger { display: block; }
    .nav-links { display: none; }
    .staff-links { width: 100%; gap: 6px; }
    .btn-register { padding: 7px 11px; font-size: 0.8rem; }
    .nav-brand img { max-height: 40px; }
    .landing-wrapper, .portal-container { padding: 70px 12px 20px; }
    .hero-text h1 { font-size: 1.5rem; margin-bottom: 12px; }
    .hero-text p { font-size: 0.95rem; margin-bottom: 15px; }
    .booking-section, .report-box { padding: 18px; border-radius: 12px; margin-bottom: 1.5rem; }
    .booking-section h2, .report-box h3 { font-size: 1.2rem; margin-bottom: 1.2rem; }
    .input-group { margin-bottom: 1rem; }
    .input-group label { font-size: 0.85rem; margin-bottom: 0.5rem; }
    .input-group input, .input-group select, .input-group textarea { padding: 11px 12px; font-size: 16px; }
    .btn-primary, button { padding: 10px 16px; font-size: 0.9rem; min-height: 40px; border-radius: 7px; }
    form > [style*="grid"] { grid-template-columns: 1fr !important; }
    .data-table { font-size: 0.8rem; }
    .data-table th, .data-table td { padding: 8px 10px; }
    .status-badge { padding: 4px 8px; font-size: 0.7rem; }
    .modal { padding: 15px !important; }
    .hide-on-mobile { display: none !important; }
    .toast { left: 10px; right: 10px; bottom: 10px; }
    .preview-img { width: 60px; height: 60px; }
}

@media (max-width: 480px) {
    .navbar { padding: 6px 10px; min-height: 55px; }
    .nav-brand img { max-height: 35px; }
    .nav-links { gap: 4px; }
    .btn-register { padding: 6px 10px; font-size: 0.75rem; }
    .landing-wrapper, .portal-container { padding: 65px 10px 15px; }
    .hero-text h1 { font-size: 1.2rem; }
    .hero-text p { font-size: 0.9rem; }
    .booking-section, .report-box { padding: 15px; }
    .booking-section h2, .report-box h3 { font-size: 1rem; }
    .input-group input, .input-group select, .input-group textarea { padding: 10px 11px; font-size: 14px; }
    .btn-primary, button { padding: 9px 14px; font-size: 0.85rem; min-height: 38px; }
    .data-table { font-size: 0.75rem; }
    .data-table th, .data-table td { padding: 6px 8px; }
    .preview-img { width: 50px; height: 50px; }
}