/* Tiferet Ovadia - Premium Admin CSS */
:root { 
    --primary: #1a237e; 
    --accent: #d4af37; 
    --bg: #f9f9f9; 
    --text-color: #333;
    --sidebar-width: 250px;
    --navbar-height: 60px;
}

body { 
    font-family: 'Segoe UI', Tahoma, sans-serif; 
    background-color: #fdfcf5;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(120, 100, 60, 0.18) 0.8px, transparent 1.2px),
        radial-gradient(circle at 70% 60%, rgba(140, 110, 70, 0.15) 0.6px, transparent 1px),
        radial-gradient(circle at 40% 80%, rgba(100, 80, 50, 0.20) 1px, transparent 1.4px),
        radial-gradient(circle at 85% 15%, rgba(130, 100, 60, 0.13) 0.7px, transparent 1.1px),
        radial-gradient(circle at 10% 65%, rgba(110, 90, 55, 0.16) 0.9px, transparent 1.3px),
        radial-gradient(circle at 55% 25%, rgba(125, 95, 60, 0.12) 0.5px, transparent 0.9px);
    background-size: 180px 180px, 220px 220px, 260px 260px, 200px 200px, 240px 240px, 160px 160px;
    background-position: 0 0, 50px 30px, 100px 80px, 30px 120px, 150px 60px, 80px 140px;
    margin: 0; 
    padding: 0; 
    direction: rtl;
    color: var(--text-color);
    overflow-x: hidden;
}

/* ============================================
   PUBLIC SITE STYLES (Banner, Nav, Container, Footer)
   ============================================ */

/* באנר עליון */
.main-banner {
    width: 100%;
    height: 300px;
    background-image: url('top-banner.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

@media (max-width: 768px) {
    .main-banner {
        height: 180px;
        background-image: url('top-banner-mobile.jpg');
    }
}

/* כפתור פורטל צף */
.floating-portal-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    background: linear-gradient(135deg, var(--primary) 0%, #283593 100%);
    color: #fff;
    text-decoration: none;
    padding: 10px 22px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    z-index: 9999;
    border: 2px solid var(--accent);
    transition: 0.25s ease;
}
.floating-portal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.35);
    background: linear-gradient(135deg, #283593 0%, var(--primary) 100%);
}

/* תפריט ניווט */
nav {
    background: linear-gradient(180deg, #1a237e 0%, #121858 100%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    border-bottom: 3px solid var(--accent);
    position: sticky;
    top: 0;
    z-index: 500;
}
.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    padding: 0 10px;
}
nav a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    padding: 14px 18px;
    font-weight: 600;
    font-size: 0.98rem;
    transition: 0.25s;
    position: relative;
    border-bottom: 3px solid transparent;
    margin-bottom: -3px;
}
nav a:hover {
    color: var(--accent);
    background: rgba(255,255,255,0.06);
}
nav a.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

@media (max-width: 768px) {
    .nav-container {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    nav a {
        padding: 12px 14px;
        font-size: 0.88rem;
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* container ראשי */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 35px 20px 60px 20px;
}

/* כותרת מרכזית */
.section-title {
    color: var(--primary);
    font-size: 2rem;
    text-align: center;
    margin-top: 0;
    margin-bottom: 25px;
    position: relative;
    padding-bottom: 15px;
}
.section-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
}

/* תוכן הירו בדף הבית */
.hero-content {
    max-width: 850px;
    margin: 0 auto;
}
.content-box {
    background: #fff;
    padding: 30px 35px;
    border-radius: 14px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.06);
    border-right: 6px solid var(--accent);
    line-height: 1.9;
    font-size: 1.1rem;
    color: #333;
    text-align: justify;
}
.content-box p {
    margin: 0;
}

/* ציטוט הרב */
.rabbi-quote {
    margin-top: 30px;
    text-align: center;
    background: linear-gradient(135deg, #fffaf0 0%, #fdfae6 100%);
    border: 1px solid var(--accent);
    border-radius: 14px;
    padding: 25px 30px;
    font-style: italic;
    font-size: 1.15rem;
    color: var(--primary);
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(212,175,55,0.15);
    position: relative;
}
.rabbi-quote::before,
.rabbi-quote::after {
    content: "❝";
    color: var(--accent);
    font-size: 1.6rem;
    opacity: 0.6;
    margin: 0 6px;
}
.rabbi-quote p {
    display: inline;
    margin: 0;
}

/* footer */
footer {
    background: #1a237e;
    color: rgba(255,255,255,0.85);
    text-align: center;
    padding: 25px 20px;
    margin-top: 40px;
    font-size: 0.95rem;
}
.footer-line {
    width: 80px;
    height: 3px;
    background: var(--accent);
    margin: 0 auto 15px auto;
    border-radius: 2px;
}
footer p {
    margin: 0;
}

/* ============================================
   END PUBLIC SITE STYLES
   ============================================ */

/* Sidebar Layout Desktop */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #121858 0%, #1a237e 100%);
    color: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    margin: 0;
    color: var(--accent);
    font-size: 1.2rem;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 15px 0;
}

.tab-btn {
    display: block;
    width: 100%;
    padding: 15px 20px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.7);
    text-align: right;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    border-right: 4px solid transparent;
}

.tab-btn:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

.tab-btn.active {
    background: rgba(255,255,255,0.1);
    color: white;
    border-right-color: var(--accent);
}

.main-content {
    flex: 1;
    margin-right: var(--sidebar-width); /* Push content past sidebar */
    padding: 20px 40px; /* תוספת מרווח מהצדדים */
    min-height: 100vh;
    box-sizing: border-box;
    overflow: visible; /* וידוא שאין גלילה פנימית */
}

/* Mobile Bottom Navigation Layout */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        bottom: 0;
        right: 0;
        top: auto;
        flex-direction: row;
        background: #1a237e;
        border-top: 1px solid rgba(255,255,255,0.1);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
        z-index: 9999;
    }
    .sidebar-header { display: none; }
    .sidebar-menu {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0;
        align-items: stretch;
    }
    .tab-btn {
        flex: 1 0 auto;
        padding: 12px 15px;
        text-align: center;
        border-right: none;
        border-bottom: 3px solid transparent;
        font-size: 0.85rem;
    }
    .tab-btn.active {
        border-right-color: transparent;
        border-bottom-color: var(--accent);
        background: rgba(255,255,255,0.1);
    }
    .main-content {
        margin-right: 0;
        padding: 15px;
        padding-bottom: 80px; /* Space for bottom nav */
    }
}

.admin-box { 
    background: transparent; /* ביטול הרקע הלבן שיוצר מסגרת */
    padding: 0; /* ביטול הריפוד הפנימי של המסגרת */
    border-radius: 0; 
    box-shadow: none; /* ביטול הצל של המסגרת */
    max-width: 100%; 
    min-height: auto;
}

h1.page-title {
    color: var(--primary);
    border-bottom: 2px solid var(--accent);
    padding-bottom: 10px;
    margin-top: 0;
}

.tab-content { display: none; animation: fadeIn 0.3s; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Forms & Inputs */
.input-group { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); 
    gap: 15px; 
    padding: 20px; 
    background: #f8faff; 
    border-radius: 12px; 
    border: 1px solid #e0e6ed;
}

input, textarea, select { 
    padding: 10px 12px; 
    border: 1px solid #cfd9e1; 
    border-radius: 8px; 
    transition: 0.2s;
    font-family: inherit;
    box-sizing: border-box;
    width: 100%;
}
input:focus, select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.1);
}

/* Premium Tables */
.table-wrapper {
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
table { 
    width: 100%; 
    border-collapse: separate; 
    border-spacing: 0;
    margin-top: 15px;
    background: white;
}
th, td { 
    border-bottom: 1px solid #f0f0f0; 
    padding: 14px; 
    text-align: right; 
}
th { 
    background: #f8faff; 
    color: var(--primary); 
    font-weight: 700;
    font-size: 0.95rem;
}
tr:hover { background-color: #fcfcfc; }

/* Existing layout for Dorm Rooms (needs to look good inside content) */
.rooms-container { 
    display: flex; gap: 8px; justify-content: space-between; margin-bottom: 20px; width: 100%; overflow-x: auto; padding-bottom: 5px; 
}
.room-card { 
    background: white; 
    border: 1px solid #e0e6ed; 
    border-radius: 12px; 
    padding: 6px; 
    flex: 1; 
    min-width: 120px; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.03); 
    display: flex; 
    flex-direction: column; 
}
.room-card h4 { margin: 0 0 6px 0; text-align: center; background: var(--primary); color: white; padding: 4px; border-radius: 4px; font-size: 13px; font-weight: bold; }
.bed-slot { background: #f8f9fa; border: 1px dashed #adb5bd; margin: 2px 0; padding: 3px 5px; border-radius: 4px; font-size: 12px; height: 26px; display: flex; align-items: center; justify-content: space-between; white-space: nowrap; overflow: hidden; }
.bed-slot.occupied { background: #e3f2fd; border: 1px solid #2196f3; color: #0d47a1; font-weight: bold; cursor: grab; }
.room-card.drag-over { border: 2px dashed #2196f3; background-color: #f1f8ff; }


/* Toast System */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.toast {
    background: white;
    color: #333;
    padding: 12px 25px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInDown 0.4s ease-out forwards;
    border-right: 5px solid #ccc;
    min-width: 200px;
}
.toast.success { border-right-color: #2ecc71; }
.toast.error { border-right-color: #e74c3c; }
.toast.info { border-right-color: #3498db; }

.toast.fade-out {
    animation: fadeOutUp 0.3s ease-in forwards;
}

@keyframes slideInDown {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeOutUp {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-50px); }
}

/* Custom Modal/Confirm */
.custom-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(3px);
    z-index: 1000000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s;
}
.custom-modal-box {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    max-width: 400px;
    width: 90%;
    text-align: center;
    direction: rtl;
}
.custom-modal-title {
    font-size: 1.2rem;
    color: var(--primary);
    margin-bottom: 15px;
    font-weight: bold;
}
.custom-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
    justify-content: center;
}
.btn-modal {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    font-family: inherit;
}
.btn-modal.confirm { background: #e74c3c; color: white; }
.btn-modal.confirm:hover { background: #c0392b; }
.btn-modal.cancel { background: #ecf0f1; color: #333; }
.btn-modal.cancel:hover { background: #bdc3c7; }

/* Utilities */
.btn { 
    padding: 10px 20px; 
    border: none; 
    border-radius: 8px; 
    cursor: pointer; 
    font-weight: bold; 
    transition: 0.2s;
}
.btn:hover { transform: translateY(-1px); }

.sidebar-user-info {
    padding: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.9rem;
    text-align: center;
    color: rgba(255,255,255,0.8);
}

.back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    text-decoration: none;
    color: white;
    font-weight: bold;
    padding: 8px 15px;
    background: #e74c3c;
    border-radius: 8px;
    transition: 0.2s;
    margin-top: 10px;
    width: 100%;
    box-sizing: border-box;
}
.back-link:hover {
    background: #c0392b;
}

@media (max-width: 768px) {
    .sidebar-user-info {
        display: none;
    }
}