/* assets/css/style.css */

/* ========== THEME: Neon Cyber (Default) ========== */
:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --text-color: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --radius: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

[data-theme="neon_cyber"] {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
}

/* ========== THEME: Dragon Red ========== */
[data-theme="dragon_red"] {
    --primary: #dc2626;
    --primary-hover: #b91c1c;
    --bg-color: #0c0a09;
    --surface-color: #1c1917;
    --text-color: #fafaf9;
    --text-muted: #a8a29e;
    --border-color: #292524;
    --success: #16a34a;
    --danger: #ef4444;
    --warning: #f97316;
    --shadow: 0 4px 10px rgba(220, 38, 38, 0.15);
}

/* ========== THEME: Neon Strike (Black + Green Gaming) ========== */
[data-theme="matrix_green"] {
    --primary: #00ff41;
    --primary-hover: #00cc33;
    --bg-color: #050505;
    --surface-color: #111111;
    --text-color: #e8e8e8;
    --text-muted: #6b6b6b;
    --border-color: #1e1e1e;
    --success: #00ff41;
    --danger: #ff2d55;
    --warning: #ffb800;
    --shadow: 0 4px 15px rgba(0, 255, 65, 0.08);
}

/* Legacy dark theme */
[data-theme="dark"] {
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: var(--primary);
}

/* Navbar */
.navbar {
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 5px;
}

.logo span {
    color: var(--primary);
}

.logo i {
    color: var(--primary);
    font-size: 28px;
}

.search-bar {
    flex: 1;
    max-width: 500px;
}

.search-bar form {
    display: flex;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.search-bar input {
    flex: 1;
    padding: 10px 15px;
    border: none;
    background: transparent;
    color: var(--text-color);
    outline: none;
}

.search-bar button {
    padding: 10px 15px;
    background: var(--bg-color);
    border: none;
    border-right: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.3s;
}

.search-bar button:hover {
    color: var(--primary);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn {
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s;
    border: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    color: white;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background-color: var(--primary);
    color: white;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.3s;
}

.icon-btn:hover {
    color: var(--primary);
}

.avatar-sm {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
}

.user-menu-wrapper {
    position: relative;
}

.user-btn {
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    color: var(--text-color);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 200px;
    padding: 10px 0;
    display: none;
    flex-direction: column;
}

.dropdown-menu.show {
    display: flex;
}

.dropdown-menu a {
    padding: 10px 20px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
}

.dropdown-menu a:hover {
    background: var(--bg-color);
}

.divider {
    height: 1px;
    background: var(--border-color);
    margin: 5px 0;
}

.text-danger {
    color: var(--danger) !important;
}

.main-content {
    flex: 1;
    padding: 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Footer */
.footer {
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    padding: 40px 20px 20px;
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 30px;
}

.footer h3 {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.footer h3 span { color: var(--primary); }
.footer h3 i { color: var(--primary); font-size: 24px; }

.footer h4 {
    margin-bottom: 15px;
    color: var(--text-color);
}

.footer ul {
    list-style: none;
}

.footer ul li {
    margin-bottom: 10px;
}

.footer ul a {
    color: var(--text-muted);
    transition: color 0.3s;
}

.footer ul a:hover {
    color: var(--primary);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}
.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-color);
    color: var(--text-color);
    box-sizing: border-box;
    transition: border-color 0.3s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
}
.auth-container {
    max-width: 450px;
    margin: 0 auto;
    background: var(--surface-color);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}
.alert {
    padding: 12px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}
.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid var(--danger);
}
.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

/* Bottom Navigation */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 9999;
    flex-direction: row;
    justify-content: space-around;
    padding: 5px 0;
}
.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    transition: color 0.3s;
    position: relative;
    padding-top: 5px;
}
.bottom-nav-item i {
    font-size: 24px;
    margin-bottom: 3px;
}
.bottom-nav-item:hover, .bottom-nav-item.active {
    color: var(--primary);
}
.bottom-nav-add {
    background: var(--primary);
    color: white !important;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-20px);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.4);
    margin: 0 10px;
}
.bottom-nav-add i {
    font-size: 28px;
    margin: 0;
}
.bottom-nav-img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 3px;
}

/* Bottom Dropdown Menu */
.bottom-user-menu-wrapper {
    position: relative;
}
.bottom-dropdown-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 50%;
    transform: translateX(50%);
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: 0 -4px 10px rgba(0,0,0,0.1);
    min-width: 180px;
    padding: 10px 0;
    display: none;
    flex-direction: column;
    z-index: 10000;
}
.bottom-dropdown-menu.show {
    display: flex;
}
.bottom-dropdown-menu a {
    padding: 10px 20px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}
.bottom-dropdown-menu a:hover {
    background: var(--bg-color);
}
.bottom-dropdown-menu i {
    font-size: 20px;
    margin-bottom: 0;
}

/* Badge overlay on ad card images */
.ad-card {
    position: relative;
}
.ad-card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    background: rgba(0,0,0,0.55);
    border-radius: 50%;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ad-card-badge img {
    width: 20px;
    height: 20px;
}

@media(max-width: 768px) {
    .nav-container {
        flex-wrap: wrap;
    }
    .search-bar {
        order: 3;
        flex: 1 1 100%;
        max-width: 100%;
        width: 100%;
        margin-top: 6px;
    }
    .logo { order: 1; }
    .nav-actions { order: 2; }
    .nav-actions .btn, .nav-actions .user-menu-wrapper, .nav-actions a[href="chat.php"] {
        display: none !important;
    }

    /* Full-width content on mobile */
    .main-content {
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-top: 10px !important;
    }

    /* Banner full-width on mobile */
    .admin-banner-slider {
        margin: 10px 0 15px 0 !important;
        border-radius: 0 !important;
    }

    /* Ads grid - FB Marketplace style */
    .ads-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
        padding: 0 15px !important;
    }
    .ad-card {
        border-radius: 0 !important;
        border: none !important;
        background: var(--bg-color) !important;
    }
    .ad-card .ad-img {
        aspect-ratio: 1;
        height: auto !important;
    }
    .ad-card .ad-content {
        padding: 6px 8px 10px 8px !important;
    }
    .ad-card h3 {
        font-size: 15px !important;
        white-space: nowrap !important;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-bottom: 2px !important;
    }
    .ad-card p { 
        display: none !important; 
    }
    .ad-card .ad-user-row {
        display: none !important;
    }
    .ad-card span[style*="font-weight: bold"] {
        font-size: 16px !important;
    }

    /* Featured ads - same compact style on mobile */
    .featured-ad-card .ad-user-info {
        display: none !important;
    }

    /* Featured ads padding on mobile */
    #featured-ads-grid {
        padding: 0 15px !important;
    }

    .bottom-nav {
        display: flex;
    }
    body {
        padding-bottom: 70px;
    }

    /* Mobile back button */
    .mobile-back-bar {
        display: flex !important;
    }

    /* Mobile scroll animations */
    .ad-card.animate-slide {
        opacity: 0;
        transform: translateX(-60px);
        transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    }
    .ad-card.animate-slide.from-right {
        transform: translateX(60px);
    }
    .ad-card.animate-slide.visible {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Mobile back button - default hidden on desktop */
.mobile-back-bar {
    display: none;
    align-items: center;
    padding: 8px 15px;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
}
.mobile-back-bar a {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s;
}
.mobile-back-bar a:hover {
    color: var(--primary);
}

/* Support chat bubble */
.support-bubble {
    position: fixed;
    bottom: 85px;
    left: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    box-shadow: 0 4px 15px rgba(99,102,241,0.4);
    z-index: 9998;
    transition: transform 0.3s, box-shadow 0.3s;
}
.support-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(99,102,241,0.5);
}

/* Custom audio player for chat */
.voice-msg-player {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 20px;
    min-width: 180px;
    max-width: 250px;
}
.voice-msg-player .play-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.2);
    color: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.msg-other .voice-msg-player .play-btn {
    background: rgba(0,0,0,0.08);
}
.voice-msg-player .voice-progress {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
}
.msg-other .voice-msg-player .voice-progress {
    background: rgba(0,0,0,0.1);
}
.voice-msg-player .voice-progress-bar {
    height: 100%;
    width: 0%;
    background: currentColor;
    border-radius: 2px;
    transition: width 0.1s linear;
}
.voice-msg-player .voice-duration {
    font-size: 11px;
    opacity: 0.8;
    min-width: 35px;
    text-align: center;
}
