/* VARIABLES */
:root {
    --blue: #5B7FC0; --blue-dark: #4A6BA8; --green: #5EAA5F; --navy: #1a2d4a; 
    --gold: #C4A962; --white: #fff; --light: #f5f7fa; --slate: #64748b;
    --font-head: 'Playfair Display', serif; --font-body: 'Source Sans 3', sans-serif;
    --shadow: 0 4px 20px rgba(0,0,0,0.06);
}

* { margin:0; padding:0; box-sizing:border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 100px; }
body { font-family: var(--font-body); background: var(--light); color: var(--navy); line-height: 1.6; display: flex; flex-direction: column; min-height: 100vh; }

/* ==================== MAIN SITE STYLES ==================== */
header { background: var(--white); border-bottom: 3px solid var(--green); }
.header-top { display: flex; justify-content: space-between; padding: 10px 20px; border-bottom: 1px solid #eee; align-items: center; }
.language-selector { display: flex; gap: 5px; }
.lang-btn { background: none; border: 1px solid #ddd; padding: 4px 8px; border-radius: 4px; cursor: pointer; font-weight: bold; font-size: 0.8rem; }
.lang-btn.active { background: var(--navy); color: white; border-color: var(--navy); }

.header-right { display: flex; gap: 10px; align-items: center; }
.auth-buttons { display: flex; gap: 10px; }
.auth-btn { padding: 6px 16px; border: 1px solid var(--navy); background: white; border-radius: 20px; cursor: pointer; font-weight: 600; font-size: 0.9rem; }
.auth-btn.primary { background: var(--green); color: white; border-color: var(--green); }
.auth-btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* User Menu */
.user-btn { display: flex; align-items: center; gap: 8px; cursor: pointer; background: #f0f4f8; padding: 5px 12px; border-radius: 20px; transition: 0.3s; }
.user-btn:hover { background: #e2e8f0; }
.avatar { width: 30px; height: 30px; background: var(--blue); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; }
.avatar.large { width: 60px; height: 60px; font-size: 1.5rem; margin: 0 auto 10px; }

/* Logo & Nav */
.header-main { text-align: center; padding: 2rem 0; }
.logo-sub { font-size: 11px; letter-spacing: 4px; margin-top: -5px; color: var(--navy); font-weight: bold; }
.tagline { color: var(--blue); font-size: 0.9rem; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; margin-top: 10px; }
nav { background: white; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.nav-links { display: flex; justify-content: center; }
.nav-links a { text-decoration: none; color: var(--navy); padding: 15px 25px; font-weight: 600; transition: 0.3s; }
.nav-links a:hover { color: var(--blue); }

/* Sections */
.container { max-width: 1200px; margin: 0 auto; padding: 40px 20px; flex: 1; }
.hero-section { background: white; border-radius: 20px; padding: 3rem; text-align: center; margin-bottom: 4rem; box-shadow: var(--shadow); border: 1px solid #eef; }
.hero-section h2 { font-family: var(--font-head); font-size: 2.2rem; margin-bottom: 1rem; }

/* Why MedMarket */
.why-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 25px; margin-top: 2rem; text-align: left; }
.why-card { background: white; padding: 25px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.04); border: 1px solid #f0f0f0; transition: 0.3s; }
.why-card:hover { transform: translateY(-5px); border-color: var(--blue); }
.why-card h3 { color: var(--navy); margin-bottom: 10px; font-size: 1.1rem; font-family: var(--font-head); }
.why-card p { font-size: 0.9rem; color: var(--slate); line-height: 1.5; }
.why-card .icon { font-size: 2rem; margin-bottom: 15px; display: block; }

/* Equipment Grid */
.section-header { text-align: center; margin: 50px 0 30px; }
.label { background: var(--green); color: white; padding: 5px 15px; border-radius: 20px; font-size: 0.75rem; text-transform: uppercase; font-weight: bold; }
.label.gold { background: var(--gold); }
.section-header h2 { font-family: var(--font-head); font-size: 2.5rem; margin-top: 10px; }
.equipment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 30px; margin-bottom: 3rem; }
.equipment-card { background: white; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); transition: 0.3s; border: 1px solid #f0f0f0; }
.equipment-card:hover { transform: translateY(-5px); box-shadow: 0 10px 30px rgba(0,0,0,0.1); }
.equipment-image { height: 220px; background: #f1f5f9; position: relative; }
.equipment-image img { width: 100%; height: 100%; object-fit: cover; }
.badge { position: absolute; top: 10px; right: 10px; background: var(--green); color: white; padding: 4px 12px; border-radius: 20px; font-size: 0.7rem; font-weight: bold; }
.badge.premium { background: var(--gold); }
.equipment-content { padding: 20px; }
.equipment-brand { font-size: 0.8rem; color: var(--blue); font-weight: 700; text-transform: uppercase; }
.equipment-content h3 { font-family: var(--font-head); font-size: 1.5rem; margin: 5px 0; }
.main-advantage { background: #f8fafc; padding: 10px; border-radius: 8px; margin: 15px 0; border-left: 3px solid var(--blue); font-size: 0.9rem; }
.equipment-specs { display: grid; gap: 5px; font-size: 0.9rem; color: var(--slate); margin-bottom: 15px; }
.spec-item { display: flex; justify-content: space-between; border-bottom: 1px solid #eee; padding-bottom: 5px; }
.price-warranty { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.price-tag { font-family: var(--font-head); font-size: 1.6rem; color: var(--green); font-weight: 700; }
.warranty-tag { font-size: 0.75rem; background: var(--navy); color: white; padding: 4px 10px; border-radius: 4px; }
.contact-btn { width: 100%; padding: 12px; background: var(--blue); color: white; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 1rem; }
.contact-btn:hover { background: var(--blue-dark); }

/* Contact Section & Footer */
.contact-section { background: linear-gradient(135deg, var(--navy), var(--blue)); padding: 4rem; border-radius: 20px; text-align: center; color: white; }
.contact-section h2 { font-family: var(--font-head); font-size: 2.2rem; margin-bottom: 1rem; }
.contact-cards { display: flex; justify-content: center; gap: 20px; margin-top: 2rem; flex-wrap: wrap; }
.c-card { background: rgba(255,255,255,0.1); padding: 20px 40px; border-radius: 12px; backdrop-filter: blur(5px); border: 1px solid rgba(255,255,255,0.2); display:flex; flex-direction:column; align-items:center;}
.c-card .icon { font-size: 1.5rem; display: block; margin-bottom: 5px; }
.c-card a { color: white; text-decoration: none; font-weight: bold; font-size: 1.1rem; display: block; }
.contact-row { display: flex; align-items: center; gap: 10px; }
.social-icon svg { transition: 0.2s; }
.social-icon:hover svg { transform: scale(1.1); }
.social-btn.fb { background: #1877F2; padding: 5px 15px; border-radius: 20px; font-size: 0.9rem; margin-top: 5px; display: inline-flex; align-items: center; }
.social-btn.fb:hover { background: #166fe5; }
footer { text-align: center; padding: 3rem; background: white; margin-top: auto; border-top: 1px solid #eee; width: 100%; }
.footer-content { display: flex; flex-direction: column; align-items: center; gap: 5px; }

/* Modals */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 2000; display: none; align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal { background: white; padding: 30px; border-radius: 16px; width: 90%; max-width: 400px; position: relative; max-height: 90vh; overflow-y: auto; }
.modal.modal-lg { max-width: 900px; padding: 0 !important; height: 600px; display: flex; overflow: hidden; flex-direction: row; border: 1px solid #ddd; }
.modal-close { position: absolute; top: 10px; right: 10px; background: none; border: none; font-size: 1.5rem; cursor: pointer; z-index: 50; width: 30px; height: 30px; line-height: 1; border-radius: 50%; background: #f0f0f0; }
.modal-close:hover { background: #e0e0e0; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 0.9rem; }
.form-group input, .form-group textarea { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 8px; font-family: inherit; }
.form-submit { width: 100%; padding: 12px; background: var(--green); color: white; border: none; border-radius: 8px; font-weight: bold; cursor: pointer; }
.form-switch { text-align: center; margin-top: 15px; font-size: 0.9rem; }
.form-switch a { color: var(--blue); cursor: pointer; text-decoration: underline; }

/* Profile Layout */
.profile-layout { display: flex; width: 100%; height: 100%; }
.profile-sidebar { width: 300px; min-width: 300px; background: #f8fafc; border-right: 1px solid #e2e8f0; padding: 20px; display: flex; flex-direction: column; z-index: 2; }
.profile-header { text-align: center; margin-bottom: 20px; }
.request-list { flex: 1; overflow-y: auto; margin-top: 10px; padding-right: 5px; }
.req-item { background: white; padding: 12px; margin-bottom: 10px; border-radius: 8px; border: 1px solid #eef; cursor: pointer; transition: 0.2s; position: relative; }
.req-item:hover, .req-item.active { border-color: var(--blue); background: #f0f7ff; }
.profile-main { flex: 1; display: flex; flex-direction: column; background: white; height: 100%; position: relative; min-width: 0; }
.chat-header { height: 60px; min-height: 60px; padding: 0 20px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; background: #fff; width: 100%; }
.chat-header strong { font-size: 1.1rem; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-messages { flex: 1; padding: 20px; overflow-y: auto; background: #f9fafb; display: flex; flex-direction: column; gap: 12px; }
.chat-input-area { height: 70px; padding: 15px; background: white; border-top: 1px solid #eee; display: flex; gap: 10px; align-items: center; }
.chat-input-area input { flex: 1; height: 40px; padding: 0 15px; border: 1px solid #ddd; border-radius: 20px; outline: none; }
.chat-input-area button { height: 40px; padding: 0 25px; background: var(--blue); color: white; border: none; border-radius: 20px; cursor: pointer; font-weight: bold; }
.chat-input-area button:hover { background: var(--blue-dark); }
.message-bubble { max-width: 75%; padding: 10px 15px; border-radius: 12px; font-size: 0.95rem; line-height: 1.4; position: relative; word-wrap: break-word; }
.message-bubble.me { background: var(--blue); color: white; align-self: flex-end; border-bottom-right-radius: 2px; }
.message-bubble.admin { background: #e2e8f0; color: var(--navy); align-self: flex-start; border-bottom-left-radius: 2px; }
.msg-time { font-size: 0.7rem; opacity: 0.7; display: block; margin-top: 4px; text-align: right; }
.profile-main.empty { align-items: center; justify-content: center; color: #999; font-style: italic; }

/* Responsive Main */
@media(max-width: 768px) {
    .header-top { flex-direction: column; gap: 10px; height: auto; padding: 15px; }
    .nav-links { flex-direction: column; gap: 0; }
    .nav-links a { padding: 10px; border-bottom: 1px solid #f0f0f0; }
    .hero-section { padding: 2rem 1rem; }
    .contact-cards { flex-direction: column; }
    .modal.modal-lg { flex-direction: column; height: 90vh; }
    .profile-sidebar { width: 100%; height: 200px; min-width: 0; border-right: none; border-bottom: 1px solid #eee; }
    .profile-main { height: calc(100% - 200px); }
}

/* ==================== ADMIN PANEL STYLES (FORCED) ==================== */
body.admin-body { 
    background: #f1f5f9; 
    height: 100vh; 
    overflow: hidden; 
    display: flex;
}

.login-container { 
    display: flex; justify-content: center; align-items: center; height: 100vh; width: 100%; background: #1a2d4a; 
}
.login-box { 
    background: white; padding: 40px; border-radius: 12px; width: 100%; max-width: 400px; text-align: center; 
}

#adminInterface { 
    width: 100%; height: 100%; 
}

.admin-layout { 
    display: flex; height: 100%; width: 100%; 
}

/* Admin Sidebar - FIXED COLORS */
.admin-sidebar { 
    width: 260px; 
    background: #1a2d4a !important; /* Force Navy */
    color: white !important; 
    display: flex; 
    flex-direction: column; 
    flex-shrink: 0;
}
.sidebar-header { padding: 25px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-nav { flex: 1; padding: 20px 0; }
.nav-item { 
    display: flex; align-items: center; gap: 12px; 
    padding: 12px 25px; color: rgba(255,255,255,0.7) !important; 
    text-decoration: none; cursor: pointer; transition: 0.2s; 
    background: none; border: none; width: 100%; text-align: left; font-size: 1rem;
}
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,0.1); color: white !important; border-left: 4px solid #5EAA5F; }
.nav-item.logout { margin-top: auto; border-top: 1px solid rgba(255,255,255,0.1); color: #ff6b6b !important; }

/* Admin Content */
.admin-content { flex: 1; padding: 0; overflow: hidden; position: relative; }
.admin-view { height: 100%; display: flex; flex-direction: column; padding: 30px; overflow-y: auto; }

/* Dashboard Stats */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 30px; }
.stat-card { background: white; padding: 20px; border-radius: 12px; border: 1px solid #e2e8f0; box-shadow: 0 2px 10px rgba(0,0,0,0.03); }
.stat-value { font-size: 2rem; font-weight: bold; color: #1a2d4a; margin-top: 5px; }
.stat-card.warning .stat-value { color: #f59e0b; }

/* Admin Tables */
.table-wrapper { background: white; border-radius: 12px; border: 1px solid #e2e8f0; overflow: hidden; flex: 1; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { background: #f8fafc; padding: 15px; text-align: left; border-bottom: 1px solid #e2e8f0; font-size: 0.85rem; text-transform: uppercase; color: #64748b; }
.admin-table td { padding: 15px; border-bottom: 1px solid #f1f5f9; cursor: pointer; font-size: 0.95rem; }
.admin-table tr:hover { background: #f8fafc; }

/* Requests Split Layout */
.requests-layout { display: flex; height: 100%; gap: 0; border: 1px solid #e2e8f0; background: white; border-radius: 12px; overflow: hidden; }
.requests-list-panel { width: 40%; border-right: 1px solid #e2e8f0; display: flex; flex-direction: column; }
.requests-list-panel h2 { padding: 20px; border-bottom: 1px solid #eee; margin: 0; font-size: 1.2rem; }
.requests-list-panel .table-wrapper { border: none; border-radius: 0; overflow-y: auto; }

.request-detail-panel { flex: 1; display: flex; flex-direction: column; background: #fff; }
.detail-header { padding: 20px; border-bottom: 1px solid #eee; background: #f8fafc; }
.status-control { margin-top: 10px; display: flex; align-items: center; gap: 10px; }
.status-control select { padding: 5px; border-radius: 4px; border: 1px solid #ccc; }

.admin-chat-area { background: #fff; }
.request-detail-panel.empty { display: flex; align-items: center; justify-content: center; color: #999; }