/* =========================================
   Reset & Base Styles
========================================= */
@import url('https://v1.fontapi.ir/css/Vazir');

body, html {
    margin: 0; padding: 0; height: 100%; overflow: hidden;
    font-family: 'Vazir', Tahoma, sans-serif;
    background-color: #e5e9f0;
}

.map-container {
    width: 100%; height: 100vh; position: absolute; top: 0; left: 0; z-index: 1;
}

/* =========================================
   Login Page Styles (استایل‌های صفحه ورود)
========================================= */
.login-container {
    display: flex; justify-content: center; align-items: center;
    height: 100vh; background: linear-gradient(135deg, #34495e, #2c3e50);
}
.login-box {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px; border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    width: 100%; max-width: 400px; text-align: center;
    backdrop-filter: blur(10px);
}
.login-box h1 { font-size: 20px; color: #2c3e50; margin-bottom: 5px; }
.login-box h2 { font-size: 16px; color: #7f8c8d; margin-bottom: 30px; }
.form-group { margin-bottom: 20px; text-align: right; }
.form-group label { display: block; font-size: 14px; color: #34495e; margin-bottom: 8px; font-weight: bold; }
.form-group input { 
    width: 100%; padding: 12px; border: 1px solid #bdc3c7; border-radius: 8px; 
    font-family: inherit; font-size: 14px; box-sizing: border-box; transition: 0.3s; 
}
.form-group input:focus { border-color: #3498db; outline: none; box-shadow: 0 0 5px rgba(52, 152, 219, 0.3); }
.btn-login { 
    width: 100%; padding: 12px; background: #3498db; color: white; border: none; 
    border-radius: 8px; font-size: 16px; cursor: pointer; transition: 0.3s; 
    font-family: inherit; font-weight: bold; margin-top: 10px;
}
.btn-login:hover { background: #2980b9; transform: translateY(-2px); }
.error-msg { color: #e74c3c; font-size: 13px; margin-top: 15px; min-height: 20px; font-weight: bold; }

/* =========================================
   Glassmorphism (افکت شیشه‌ای نقشه)
========================================= */
.glass-widget, .glass-btn, .glass-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    position: absolute;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* =========================================
   Floating Triggers (دکمه‌های باز کردن پنل)
========================================= */
.float-right { top: 25px; right: 25px; border-radius: 50%; width: 55px; height: 55px; cursor: pointer; font-size: 22px; color: #2c3e50; border: none;}
.float-left { top: 25px; left: 25px; border-radius: 50%; width: 55px; height: 55px; cursor: pointer; font-size: 22px; color: #2c3e50; border: none;}
.float-right:hover, .float-left:hover { background: #fff; transform: scale(1.1); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15); }

/* =========================================
   Panels (پنل‌های کشویی لایه‌ها و ابزارها)
========================================= */
.glass-panel {
    top: 25px; bottom: 25px; width: 340px; border-radius: 20px; 
    display: flex; flex-direction: column; overflow: hidden;
}
.panel-right { right: -400px; }
.panel-left { left: -400px; }
.panel-right.active { right: 25px; }
.panel-left.active { left: 25px; }

.panel-header {
    background: rgba(44, 62, 80, 0.05);
    padding: 20px;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.panel-header h3 { margin: 0; font-size: 16px; color: #2c3e50; }
.close-btn { background: none; border: none; font-size: 18px; color: #e74c3c; cursor: pointer; transition: 0.2s;}
.close-btn:hover { transform: rotate(90deg); }

.panel-content { padding: 20px; overflow-y: auto; }

/* =========================================
   Layers Switch (دکمه‌های خاموش/روشن مدرن)
========================================= */
.layer-group { margin-bottom: 25px; }
.layer-group h4 { margin: 0 0 15px 0; font-size: 13px; color: #7f8c8d; border-bottom: 1px dashed #bdc3c7; padding-bottom: 8px;}

.layer-switch { display: flex; align-items: center; margin-bottom: 15px; cursor: pointer; font-size: 14px; color: #34495e;}
.layer-switch input { display: none; }
.slider {
    position: relative; width: 44px; height: 24px; background-color: #ccc; 
    border-radius: 34px; margin-left: 12px; transition: .4s;
}
.slider:before {
    position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; 
    background-color: white; border-radius: 50%; transition: .4s;
}
.layer-switch input:checked + .slider { background-color: #27ae60; }
.layer-switch input:checked + .slider:before { transform: translateX(20px); }

/* =========================================
   Tools Buttons (دکمه‌های ابزار)
========================================= */
.tool-btn {
    width: 100%; padding: 12px 15px; margin-bottom: 10px; border: none;
    border-radius: 10px; background: #f8f9fa; color: #2c3e50; font-family: inherit;
    font-size: 14px; text-align: right; cursor: pointer; transition: 0.3s;
    display: flex; align-items: center; gap: 10px; font-weight: 500;
}
.tool-btn i { font-size: 16px; width: 25px; text-align: center; color: #3498db; }
.tool-btn:hover { background: #e0e6ed; transform: translateY(-2px); }
.btn-primary { background: #3498db; color: white; }
.btn-primary i { color: white; }
.btn-primary:hover { background: #2980b9; }
.glass-divider { border: 0; height: 1px; background: rgba(0,0,0,0.1); margin: 20px 0; }

/* =========================================
   Profile & Logout Widget (پروفایل و خروج)
========================================= */
.top-left { 
    top: 25px; left: 100px; padding: 8px 15px; border-radius: 50px; 
    display: flex; align-items: center; gap: 15px; background: rgba(255, 255, 255, 0.95);
}
.user-info { display: flex; align-items: center; gap: 8px; color: #2c3e50; font-size: 14px;}
.user-badge { background: #f39c12; color: white; padding: 3px 8px; border-radius: 12px; font-size: 11px;}

.btn-logout { 
    background: #e74c3c; color: white; border-radius: 50%; width: 35px; height: 35px; 
    display: flex; justify-content: center; align-items: center; text-decoration: none; 
    transition: 0.3s; box-shadow: 0 4px 10px rgba(231, 76, 60, 0.3);
}
.btn-logout:hover { background: #c0392b; transform: scale(1.1) rotate(15deg); }

/* =========================================
   Basemap Widget (نقشه‌های پایه)
========================================= */
.bottom-left { bottom: 25px; left: 25px; padding: 8px; border-radius: 15px; display: flex; gap: 8px; }
.basemap-btn {
    background: transparent; border: none; font-size: 20px; color: #7f8c8d;
    cursor: pointer; padding: 8px 12px; border-radius: 10px; transition: 0.3s;
}
.basemap-btn:hover, .basemap-btn.active { background: #3498db; color: white; }

/* =========================================
   OpenLayers Tooltips (برچسب‌های ابزار اندازه‌گیری)
========================================= */
.ol-tooltip {
    position: relative;
    background: rgba(44, 62, 80, 0.9);
    border-radius: 6px;
    color: white;
    padding: 6px 10px;
    opacity: 0.9;
    white-space: nowrap;
    font-size: 13px;
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    direction: ltr; /* برای نمایش درست اعداد و واحدها */
    z-index: 9999 !important; /* رفع مشکل مخفی شدن زیر لایه‌ها */
}
.ol-tooltip-measure {
    opacity: 1;
    font-weight: bold;
}
.ol-tooltip-static {
    background-color: #e74c3c;
    border: 1px solid white;
}

/* =========================================
   Reports Panel (پنل کشویی تاریخچه ممیزی)
========================================= */
.float-bottom-right { 
    bottom: 25px; right: 25px; border-radius: 50%; width: 50px; height: 50px; 
    cursor: pointer; font-size: 20px; color: #2c3e50; border: none; 
    display: flex; justify-content: center; align-items: center; position: absolute;
}
.float-bottom-right:hover { background: #fff; transform: scale(1.1); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15); }

.panel-bottom-right {
    bottom: 85px; /* قرارگیری دقیقاً بالای دکمه */
    right: -400px; /* مخفی بودن پیش‌فرض در خارج از صفحه */
    width: 260px; /* عرض بسیار کوچکتر و جمع‌وجور */
    max-height: 250px;
    border-radius: 15px;
}
.panel-bottom-right.active {
    right: 25px; /* ورود به صفحه */
}

/* اصلاح چیدمان آیتم‌ها برای جا شدن مختصات */
.reports-list li { 
    padding: 8px 12px; 
    border-bottom: 1px solid rgba(0,0,0,0.06); 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    gap: 10px; /* فاصله ایمن بین آیکون و عدد */
}
.reports-list li:last-child { border-bottom: none; }

.reports-list li span {
    white-space: nowrap; /* جلوگیری از شکستن اسم ابزار */
    color: #34495e;
}

.reports-list li strong {
    font-size: 11.5px; /* فونت کمی ریزتر برای مختصات */
    text-align: left;
    line-height: 1.5;
    color: #2c3e50;
}

.reports-list li.live-measure { 
    color: #e74c3c; font-weight: bold; background: rgba(231, 76, 60, 0.1); border-radius: 5px; 
}

/* =========================================
   اسکرول‌بار اختصاصی (Custom Scrollbar)
========================================= */
.reports-list::-webkit-scrollbar {
    width: 5px; /* نازک و مینیمال */
}
.reports-list::-webkit-scrollbar-track {
    background: transparent; 
}
.reports-list::-webkit-scrollbar-thumb {
    background: rgba(44, 62, 80, 0.3); 
    border-radius: 10px;
}
.reports-list::-webkit-scrollbar-thumb:hover {
    background: rgba(44, 62, 80, 0.6); 
}

/* =========================================
   Upload Wizard Modal (استایل پاپ‌آپ بارگذاری)
========================================= */
.glass-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex; justify-content: center; align-items: center;
    opacity: 0; visibility: hidden; transition: 0.3s;
}
.glass-modal-overlay.active {
    opacity: 1; visibility: visible;
}
.glass-modal {
    background: rgba(255, 255, 255, 0.95);
    width: 90%; max-width: 500px;
    border-radius: 15px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
    overflow: hidden;
    transform: translateY(30px); transition: 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    direction: rtl;
}
.glass-modal-overlay.active .glass-modal {
    transform: translateY(0);
}
.modal-header {
    background: #2c3e50; color: white; padding: 15px 20px; 
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 25px; }
.modal-footer { 
    padding: 15px 25px; background: rgba(0,0,0,0.03); 
    display: flex; justify-content: space-between; border-top: 1px solid rgba(0,0,0,0.05); 
}
.wizard-step { display: none; }
.wizard-step.active { display: block; animation: fadeIn 0.4s; }
@keyframes fadeIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: translateX(0); } }

.wizard-step h4 { margin-top: 0; color: #2980b9; border-bottom: 2px solid #ecf0f1; padding-bottom: 10px;}
.form-control { 
    width: 100%; padding: 10px; margin-top: 5px; margin-bottom: 15px; 
    border: 1px solid #bdc3c7; border-radius: 8px; font-family: inherit; box-sizing: border-box;
}
.form-control:focus { border-color: #3498db; outline: none; }
.btn { padding: 10px 20px; border: none; border-radius: 8px; cursor: pointer; font-family: inherit; font-weight: bold; transition: 0.2s; font-size: 14px;}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: #3498db; color: white; }
.btn-secondary { background: #95a5a6; color: white; }
.btn-success { background: #27ae60; color: white; }