/* Admin Overlay */
#adminOverlay { position:fixed; inset:0; z-index:9999; background:#0a0a0a; overflow:auto; font-family: 'Segoe UI', Tahoma, sans-serif; color: #fff; direction: rtl; }
#adminOverlay .hidden { display: none !important; }

/* Login */
.login-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0a192f 0%, #000 100%); }
.login-card { background: #1a1a1a; padding: 40px; border-radius: 16px; width: 100%; max-width: 400px; border: 1px solid #333; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.login-logo { text-align: center; margin-bottom: 30px; }
.login-logo h1 { color: #D4AF37; font-size: 28px; margin-bottom: 5px; }
.login-logo p { color: #888; font-size: 14px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; color: #ccc; font-size: 14px; }
.form-group input { width: 100%; padding: 12px 16px; background: #0a0a0a; border: 1px solid #333; border-radius: 8px; color: #fff; font-size: 16px; }
.form-group input:focus { outline: none; border-color: #D4AF37; }
.btn-primary { width: 100%; padding: 14px; background: #D4AF37; color: #000; border: none; border-radius: 8px; font-size: 16px; font-weight: bold; cursor: pointer; transition: all 0.3s; }
.btn-primary:hover { background: #c19b2e; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.error { background: #ff4444; color: white; padding: 10px; border-radius: 6px; margin-bottom: 15px; font-size: 14px; text-align: center; }
.success { background: #4ade80; color: black; padding: 10px; border-radius: 6px; margin-bottom: 15px; font-size: 14px; text-align: center; }
.security-badge { text-align: center; margin-top: 20px; color: #666; font-size: 12px; }

/* Dashboard */
.dashboard { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: #111; border-left: 1px solid #222; padding: 20px 0; position: fixed; height: 100vh; overflow-y: auto; }
.sidebar-logo { padding: 0 20px 20px; border-bottom: 1px solid #222; margin-bottom: 20px; }
.sidebar-logo h2 { color: #D4AF37; font-size: 20px; }
.sidebar-logo p { color: #666; font-size: 12px; margin-top: 4px; }
.nav-item { padding: 12px 20px; color: #aaa; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 12px; border-right: 3px solid transparent; }
.nav-item:hover { background: #1a1a1a; color: #fff; }
.nav-item.active { background: #1a1a1a; color: #D4AF37; border-right-color: #D4AF37; }
.nav-item svg { width: 20px; height: 20px; }

.main { flex: 1; margin-right: 260px; background: #0a0a0a; }
.topbar { background: #111; border-bottom: 1px solid #222; padding: 16px 30px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 10; }
.topbar h1 { font-size: 22px; color: #fff; }
.user-menu { display: flex; align-items: center; gap: 15px; }
.user-avatar { width: 36px; height: 36px; background: #D4AF37; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #000; font-weight: bold; cursor: pointer; }

.content { padding: 30px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card { background: #111; border: 1px solid #222; border-radius: 12px; padding: 20px; }
.stat-card h3 { color: #888; font-size: 13px; margin-bottom: 8px; font-weight: normal; }
.stat-card .value { font-size: 28px; font-weight: bold; color: #fff; margin-bottom: 5px; }
.stat-card .change { font-size: 12px; color: #4ade80; }

.card { background: #111; border: 1px solid #222; border-radius: 12px; padding: 24px; margin-bottom: 20px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.card-header h2 { font-size: 18px; color: #fff; }
.btn { padding: 8px 16px; background: #D4AF37; color: #000; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 500; }
.btn-secondary { background: #333; color: #fff; }

table { width: 100%; border-collapse: collapse; }
th { text-align: right; padding: 12px; color: #888; font-size: 12px; font-weight: 500; border-bottom: 1px solid #222; }
td { padding: 14px 12px; border-bottom: 1px solid #1a1a1a; font-size: 14px; }
tr:hover { background: #0f0f0f; }
.badge { padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 500; }
.badge-gold { background: rgba(212,175,55,0.2); color: #D4AF37; }
.badge-green { background: rgba(74,222,128,0.2); color: #4ade80; }

.property-img { width: 50px; height: 38px; background: #222; border-radius: 6px; object-fit: cover; }
.actions { display: flex; gap: 8px; }
.action-btn { padding: 5px 10px; background: #1a1a1a; border: 1px solid #333; border-radius: 4px; color: #aaa; cursor: pointer; font-size: 12px; }
.action-btn:hover { background: #222; color: #fff; }

.tabs { display: flex; gap: 5px; border-bottom: 1px solid #222; margin-bottom: 20px; }
.tab { padding: 10px 20px; cursor: pointer; color: #888; border-bottom: 2px solid transparent; font-size: 14px; }
.tab.active { color: #D4AF37; border-bottom-color: #D4AF37; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 15px; }
.form-full { grid-column: 1 / -1; }

.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center; z-index: 10000; }
.modal-content { background: #111; border: 1px solid #333; border-radius: 12px; padding: 30px; width: 90%; max-width: 600px; max-height: 90vh; overflow-y: auto; }

.firebase-status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: rgba(74,222,128,0.15); color: #4ade80; border-radius: 12px; font-size: 11px; }
.firebase-status::before { content: ''; width: 6px; height: 6px; background: #4ade80; border-radius: 50%; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Modal components */
.modal-overlay { position:fixed; inset:0; z-index:10000; background:rgba(0,0,0,0.8); display:flex; align-items:center; justify-content:center; padding:20px; }
.modal-overlay.hidden { display:none !important; }
.modal-content { background:#111; border:1px solid #333; border-radius:16px; width:100%; max-height:90vh; overflow-y:auto; }
.modal-header { display:flex; justify-content:space-between; align-items:center; padding:20px 24px; border-bottom:1px solid #222; }
.modal-header h3 { font-size:18px; color:#fff; }
.modal-close { background:none; border:none; color:#888; font-size:28px; cursor:pointer; padding:0; line-height:1; }
.modal-close:hover { color:#fff; }
.modal-body { padding:24px; }
.modal-body input, .modal-body select, .modal-body textarea { width:100%; padding:10px 14px; background:#0a0a0a; border:1px solid #333; border-radius:8px; color:#fff; font-size:14px; font-family:inherit; box-sizing:border-box; }
.modal-body input:focus, .modal-body select:focus, .modal-body textarea:focus { outline:none; border-color:#D4AF37; }
.modal-body select { appearance:auto; }
.modal-body textarea { resize:vertical; min-height:80px; }
.modal-body .form-group { margin-bottom:16px; }
.modal-body .form-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:0; }
.modal-body label { display:flex; align-items:center; gap:8px; color:#ccc; font-size:14px; margin-bottom:6px; cursor:pointer; }
.modal-body input[type="checkbox"] { width:16px; height:16px; accent-color:#D4AF37; }

/* Status badges */
.badge-reserved { background:rgba(255,193,7,0.2); color:#ffc107; }
.badge-sold, .badge-rented { background:rgba(74,222,128,0.2); color:#4ade80; }
.badge-pending { background:rgba(255,165,0,0.2); color:#ffa500; }
.badge-completed { background:rgba(74,222,128,0.2); color:#4ade80; }
.badge-cancelled { background:rgba(255,68,68,0.2); color:#ff4444; }

/* Summary badges in sidebar */
.sidebar .badge { font-size:11px; padding:2px 8px; margin-right:auto; }

@media (max-width: 768px) {
    .sidebar { transform:translateX(100%); width:240px; }
    .sidebar.open { transform:translateX(0); }
    .main { margin-right:0; }
    .stats-grid { grid-template-columns:1fr 1fr; }
    .form-row { grid-template-columns:1fr; }
    .card-header { flex-direction:column; align-items:stretch; gap:10px; }
    .content { padding:16px; }
    table { font-size:13px; }
    th, td { padding:8px 6px; }
    .modal-body .form-row { grid-template-columns:1fr; }
    .modal-content { max-width:100%; margin:10px; }
}

/* Daily Follow-Up */
#dailyTable td:nth-child(6) { max-width:200px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#dailyModal .modal-content { max-width:500px; }

/* Most Viewed */
#mostViewedTable td:first-child { color:#D4AF37; font-weight:bold; }
#mostViewedTable td:last-child { text-align:center; }

/* Storage radio labels */
input[name="storageMethod"]:checked + span { color:#D4AF37; }
