/**
 * D-Life Smart Building Management - Ultimate Unified Stylesheet
 * Optimized for: Babak Kaviani's PHP/MySQL Project
 * Theme: Future Tech / Clean Lab (Light Mode)
 */

:root {
    --accent-cyan: #06b6d4;
    --accent-blue: #3a7bd5;
    --aviation-red: #ff0000;
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --input-border: #e2e8f0;
    --input-bg: rgba(255, 255, 255, 0.9);
}

/* --- تنظیمات پایه (بسیار مهم برای جلوگیری از خرابی کادرها) --- */
* { 
    box-sizing: border-box; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
}

body {
    margin: 0; padding: 0;
    font-family: 'Tahoma', 'Segoe UI', sans-serif;
    background: radial-gradient(circle at center, #f8fafc, #cbd5e1);
    color: var(--text-main);
    direction: rtl;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =========================================
   ۱. لوگوی نئونی اختصاصی (Neon Towers)
   ========================================= */
.logo-container {
    position: relative;
    width: 150px; height: 165px;
    display: flex; align-items: flex-end; justify-content: center;
    margin: 0 auto;
    z-index: 20;
}

.red-beacon {
    position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 10px; height: 10px; background: var(--aviation-red);
    border-radius: 50%; z-index: 10;
    box-shadow: 0 0 15px var(--aviation-red), 0 0 30px rgba(255, 0, 0, 0.3);
    animation: redFlash 2.5s infinite ease-in-out;
}

@keyframes redFlash {
    0%, 100% { opacity: 0.4; transform: translateX(-50%) scale(0.8); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.2); box-shadow: 0 0 25px var(--aviation-red); }
}

.building {
    position: relative; bottom: 10px;
    background: linear-gradient(to top, rgba(58, 123, 213, 0.3), rgba(0, 210, 255, 0.5));
    border: 1px solid rgba(0, 210, 255, 0.5);
    backdrop-filter: blur(5px);
}

.b-speed { width: 30px; height: 80px; margin-left: -10px; transform: skewX(8deg); overflow: hidden; }
.b-speed::after { 
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
    background: repeating-linear-gradient(-45deg, transparent, transparent 6px, rgba(58, 123, 213, 0.1) 6px, rgba(58, 123, 213, 0.1) 8px); 
}

.b-main { 
    width: 40px; height: 125px; z-index: 3; 
    box-shadow: 0 10px 30px rgba(58, 123, 213, 0.2); 
    border-color: rgba(0, 210, 255, 0.6); 
    background: rgba(255,255,255,0.85);
}

.b-main::after { 
    content: ''; position: absolute; top: 10px; left: 5px; right: 5px; bottom: 5px; 
    background-image: linear-gradient(rgba(0, 150, 255, 0.1) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 150, 255, 0.1) 1px, transparent 1px); 
    background-size: 8px 8px; 
}

.b-side { width: 25px; height: 65px; margin-right: -10px; opacity: 0.8; }

.horizon { 
    position: absolute; bottom: 0; width: 150%; height: 3px; 
    background: linear-gradient(90deg, transparent, var(--accent-blue), transparent); 
    box-shadow: 0 -5px 20px rgba(0, 210, 255, 0.4); 
}

/* =========================================
   ۲. فرم‌های ورود و ثبت‌نام (Login / Signup)
   ========================================= */
.glass-card {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 35px;
    padding: 40px;
    width: 95%;
    max-width: 480px;
    text-align: center;
    box-shadow: 0 25px 60px rgba(58, 123, 213, 0.12);
    margin: 40px auto;
}

.form-box { display: none; opacity: 0; }
.form-active { display: block; opacity: 1; animation: fadeIn 0.5s ease forwards; }

input, select, textarea {
    width: 100%;
    padding: 15px;
    margin-bottom: 20px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 14px;
    text-align: center;
    outline: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    display: block;
}

input:focus { 
    border-color: var(--accent-blue); 
    box-shadow: 0 8px 20px rgba(58, 123, 213, 0.1); 
    transform: translateY(-2px); 
    background: #fff;
}

.input-row { 
    display: flex; 
    gap: 15px; 
    width: 100%; 
    margin-bottom: 0; 
}

.input-row input { 
    flex: 1; 
    width: 100%; /* در فلکس باکس عرض واقعی را حفظ می‌کند */
}

.btn-glow {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(45deg, var(--accent-blue), var(--accent-cyan));
    color: white;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(58, 123, 213, 0.3);
    margin-top: 10px;
}

.btn-glow:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 12px 30px rgba(58, 123, 213, 0.4); 
}

/* لینک‌های تغییر فرم */
.switch-link {
    display: block;
    margin-top: 25px;
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
}

.switch-link strong { color: var(--accent-blue); }
.switch-link:hover strong { color: var(--accent-cyan); text-decoration: underline; }

/* =========================================
   ۳. چیدمان داشبورد و سایدبار (Dashboard)
   ========================================= */
.main-layout { display: flex; min-height: 100vh; width: 100%; }

.sidebar {
    width: 280px;
    background: #ffffff;
    border-left: 1px solid var(--input-border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-top { padding: 40px 10px 10px; text-align: center; }

.side-menu { padding: 20px; flex: 1; }

.menu-item {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 16px;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 15px;
}

.menu-item i { width: 30px; font-size: 18px; margin-left: 12px; }

.menu-item:hover, .menu-item.active {
    background: #eff6ff;
    color: var(--accent-blue);
    transform: translateX(-5px);
}

.menu-item.logout { color: var(--aviation-red); margin-top: 40px; }
.menu-item.logout:hover { background: #fef2f2; }

/* منطقه محتوا (Main Content Area) */
.content-area { flex: 1; display: flex; flex-direction: column; background: transparent; }

.top-bar { 
    height: 80px; 
    padding: 0 40px; 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
}

.welcome-section { display: flex; align-items: center; }

/* آواتار دایره‌ای */
.user-avatar-circle {
    width: 44px; height: 44px;
    background: #ffffff;
    border: 2px solid var(--accent-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(58, 123, 213, 0.15);
}

.user-avatar-circle i { font-size: 24px; color: var(--accent-blue); }

.dash-footer {
    padding: 25px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid rgba(0,0,0,0.05);
}

.dash-footer a { color: var(--accent-blue); text-decoration: none; font-weight: bold; }

/* =========================================
   ۴. انیمیشن‌ها و ریسپانسیو
   ========================================= */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* دکمه منوی موبایل */
.mobile-toggle {
    display: none;
    position: fixed;
    top: 15px; left: 15px;
    width: 50px; height: 50px;
    background: white;
    border: 1px solid var(--input-border);
    border-radius: 15px;
    z-index: 2000;
    color: var(--accent-blue);
    font-size: 20px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

@media (max-width: 1024px) {
    .sidebar { position: fixed; right: -280px; height: 100vh; }
    .sidebar.active { right: 0; box-shadow: -20px 0 50px rgba(0,0,0,0.1); }
    .mobile-toggle { display: block; }
    .content-area { width: 100%; }
    .top-bar { padding-right: 80px; }
    .glass-card { margin: 100px auto 40px; }
}

@media (max-width: 480px) {
    .glass-card { padding: 30px 20px; border-radius: 25px; box-shadow: none; background: transparent; border: none; }
.property-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}
.property-card {
    background: white; padding: 25px; border-radius: 25px;
    border: 1px solid var(--input-border); position: relative;
}
.card-badge {
    position: absolute; top: 15px; left: 15px;
    background: #eff6ff; color: var(--accent-blue);
    padding: 4px 10px; border-radius: 8px; font-size: 11px; font-weight: bold;
}
.btn-sm {
    background: #f1f5f9; color: var(--text-main);
    padding: 8px 15px; border-radius: 10px; font-size: 13px; font-weight: 600;
}
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4); backdrop-filter: blur(8px);
    z-index: 3000; display: flex; align-items: center; justify-content: center;
}
.close-btn { position: absolute; top: 20px; left: 20px; cursor: pointer; font-size: 24px; }
    .input-row { flex-direction: column; gap: 0; }
}

/* افکت کلی باکس‌ها */
.smart-form .input-group input, 
.smart-form .input-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.3s ease;
}

/* افکت انتخاب (Hover/Focus) برای تمام بردرها */
.smart-form .input-group input:hover, 
.smart-form .input-group select:hover {
    border-color: var(--accent-blue);
    background: #f0f7ff;
    box-shadow: 0 0 8px rgba(37, 99, 235, 0.1);
}

.smart-form .form-row { display: flex; gap: 15px; margin-bottom: 15px; }
.smart-form .input-group { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.smart-form .input-group label { font-size: 11px; color: #64748b; font-weight: bold; margin-right: 5px; }

/* تراز دقیق باکس پارکینگ */
.parking-box input { text-align: center; font-weight: bold; color: var(--accent-blue); }

/* دکمه با افکت Glow مشابه لاگین */
.btn-submit-glow {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 15px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: 0.4s;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.btn-submit-glow:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.5);
    filter: brightness(1.1);
}

/* استایل دکمه آپلود */
.file-wrapper { display: flex; align-items: center; gap: 15px; background: #f8fafc; padding: 10px; border-radius: 12px; width: 100%; }
.btn-upload { background: #fff; border: 1px solid #e2e8f0; padding: 8px 15px; border-radius: 8px; cursor: pointer; font-size: 12px; }
#building_image { display: none; }

/* =========================================
    ۵. اختصاصی مدیریت ساختمان (Side Drawer & Cards)
   ========================================= */

/* گرید کارت‌ها */
.b-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 25px; padding: 20px; }

.b-card { 
    background: var(--bg-card); border-radius: 24px; overflow: hidden; 
    border: 1px solid var(--input-border); position: relative; transition: 0.4s;
}
.b-card:hover { 
    transform: translateY(-8px); border-color: var(--accent-blue); 
    box-shadow: 0 20px 40px rgba(58, 123, 213, 0.15); 
}

.b-card-img { height: 180px; background-size: cover; background-position: center; position: relative; background-color: #f1f5f9; }

.b-edit-btn { 
    position: absolute; top: 12px; right: 12px; background: white; border: none; 
    width: 36px; height: 36px; border-radius: 50%; color: var(--accent-blue); 
    display: flex; align-items: center; justify-content: center; cursor: pointer; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); z-index: 10;
}
.b-edit-btn:hover { background: var(--accent-blue); color: white; transform: rotate(15deg); }

.b-card-body { padding: 20px; text-align: right; }
.b-card-body h3 { margin: 0 0 10px; font-size: 18px; color: var(--text-main); }

/* کادر شیک کد دعوت */
.b-invite-box { 
    background: #f8fafc; border: 2px dashed #cbd5e1; border-radius: 16px; 
    padding: 12px; text-align: center; margin: 15px 0; 
}
.b-invite-box span { font-size: 10px; color: var(--text-muted); display: block; }
.b-invite-box strong { font-family: monospace; font-size: 20px; color: var(--accent-blue); letter-spacing: 2px; }

.b-btn-manage { 
    display: flex; align-items: center; justify-content: center; gap: 8px; 
    background: var(--accent-blue); color: white; text-decoration: none; 
    padding: 12px; border-radius: 14px; font-weight: bold; transition: 0.3s; 
}

/* Side Drawer (پنل کشویی) */
.drawer-overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(8px); 
    display: none; justify-content: flex-end; z-index: 9999; 
}
.drawer-content { 
    width: 100%; max-width: 500px; height: 100vh; background: white; 
    padding: 40px; overflow-y: auto; position: relative;
    animation: slideInRight 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-shadow: -10px 0 40px rgba(0,0,0,0.1); border-radius: 30px 0 0 30px;
}
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }

.drawer-close { position: absolute; top: 20px; left: 20px; font-size: 28px; color: #cbd5e1; cursor: pointer; }
.drawer-close:hover { color: var(--aviation-red); }

/* فیلد پارکینگ تراز شده */
.parking-container { 
    display: flex; align-items: center; background: var(--input-bg); 
    border: 1px solid var(--input-border); border-radius: 14px; padding-right: 15px;
}
.parking-container span { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.parking-container input { border: none !important; margin-bottom: 0 !important; text-align: center; font-weight: bold; }