/* =============================================
   MATRIMONY PLATFORM - GLOBAL STYLES
   ============================================= */

/* Import Google Fonts - Montserrat */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #c0392b;
    --primary-dark: #962d22;
    --secondary: #f2eb1d;
    --accent: #c0392b;
    --bg-light: #fdf6f0;
    --bg-white: #ffffff;
    --text-dark: #2c3e50;
    --text-muted: #7f8c8d;
    --border: #e0e0e0;
    --success: #27ae60;
    --danger: #c0392b;
    --warning: #f2eb1d;
    --info: #2980b9;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Montserrat', 'Bell MT', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
}

a { text-decoration: none; color: inherit; }

/* ---- NAVBAR ---- */
.navbar {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.navbar .logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
    font-family: 'Bell MT', 'Montserrat', serif;
}

.navbar .logo img {
    height: 85px !important;
    max-width: 320px !important;
}

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

.nav-links { display: flex; gap: 1.5rem; align-items: center; }

.nav-links a {
    color: rgba(255,255,255,0.9);
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav-links a:hover { color: var(--secondary); }

/* Register Free Button - Override all other styles */
nav .nav-links a.btn-nav,
.nav-links a.btn-nav {
    background: var(--secondary) !important;
    color: #000000 !important;
    padding: 0.4rem 1.2rem;
    border-radius: 20px;
    font-weight: 900 !important;
    text-shadow: none !important;
    transition: all 0.3s ease;
}

nav .nav-links a.btn-nav:hover,
.nav-links a.btn-nav:hover {
    background: #d9d419 !important;
    color: #000000 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(242, 235, 29, 0.4);
}

/* ---- BUTTONS ---- */
.btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: #2c3e50; font-weight: 700; }
.btn-secondary:hover { background: #d9d419; color: #2c3e50; }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 0.35rem 0.9rem; font-size: 0.85rem; }
.btn-block { width: 100%; text-align: center; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 1.2rem; }

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    background: #fff;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(192,57,43,0.1);
}

/* ---- CARDS ---- */
.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 1.1rem;
    background: linear-gradient(135deg, var(--primary-light), #fff);
    color: var(--primary);
}

.card-body { padding: 1.5rem; }

/* ---- PROFILE CARD ---- */
.profile-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    position: relative;
}

.profile-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.profile-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

/* Photo wrapper must NOT clip the overlay buttons */
.profile-card .photo-wrap {
    position: relative;
    overflow: hidden;
}

/* Heart overlay — top right of photo */
.card-heart-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    z-index: 10;
    transition: transform 0.2s;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.card-heart-btn:hover   { transform: scale(1.15); }
.card-heart-not-sent    { background: rgba(233,32,40,0.92);  color: #fff; }
.card-heart-pending     { background: rgba(243,156,18,0.95); color: #fff; }
.card-heart-accepted    { background: rgba(39,174,96,0.95);  color: #fff; }

/* Shortlist overlay — below heart */
.card-shortlist-btn {
    position: absolute;
    top: 54px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    z-index: 10;
    transition: transform 0.2s;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.card-shortlist-btn:hover { transform: scale(1.15); }
.card-shortlist-on  { background: rgba(243,156,18,0.95); color: #fff; }
.card-shortlist-off { background: rgba(255,255,255,0.88); color: #666; }

.profile-card .profile-info {
    padding: 1rem;
}

.profile-card .profile-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
}

.profile-card .profile-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* No bottom action bar — all actions are photo overlays */
.profile-card .profile-actions { display: none; }

/* ---- GRID ---- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

/* ---- ALERTS ---- */
.alert {
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-success { background: #d5f5e3; color: #1e8449; border-left: 4px solid var(--success); }
.alert-danger { background: #fadbd8; color: #922b21; border-left: 4px solid var(--danger); }
.alert-warning { background: #fef9e7; color: #9a7d0a; border-left: 4px solid var(--warning); }
.alert-info { background: #d6eaf8; color: #1a5276; border-left: 4px solid var(--info); }

/* ---- BADGE ---- */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #d5f5e3; color: var(--success); }
.badge-danger { background: #fadbd8; color: var(--danger); }
.badge-warning { background: #fef9e7; color: var(--warning); }
.badge-primary { background: #fadbd8; color: var(--primary); }

/* ---- SIDEBAR LAYOUT ---- */
.layout { display: flex; min-height: calc(100vh - 80px); }

.sidebar {
    width: 250px;
    background: #fff;
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    height: calc(100vh - 80px);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar .menu-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1.5rem;
    color: var(--text-dark);
    font-size: 0.95rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar .menu-item:hover,
.sidebar .menu-item.active {
    background: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary);
}

.sidebar .menu-item i { width: 20px; text-align: center; }

.main-content { flex: 1; padding: 2rem; overflow-y: auto; }

/* ---- HERO SECTION ---- */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    padding: 5rem 2rem;
    text-align: center;
}

.hero h1 { font-size: 3rem; font-weight: 800; margin-bottom: 1rem; }
.hero p { font-size: 1.2rem; opacity: 0.9; margin-bottom: 2rem; }

/* ---- STATS ---- */
.stats-bar {
    background: #fff;
    padding: 2rem;
    display: flex;
    justify-content: center;
    gap: 4rem;
    box-shadow: var(--shadow);
}

.stat-item { text-align: center; }
.stat-item .number { font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-item .label { font-size: 0.9rem; color: var(--text-muted); }

/* ---- TABLE ---- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 0.8rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
.table th { background: #f8f9fa; font-weight: 600; font-size: 0.9rem; color: var(--text-muted); }
.table tr:hover td { background: var(--primary-light); }

/* Auto horizontal scroll for tables inside card-body on all screen sizes */
.card-body { overflow-x: auto; }

/* ---- PAGINATION ---- */
.pagination { display: flex; gap: 0.5rem; justify-content: center; margin-top: 2rem; }
.pagination a {
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-dark);
    font-size: 0.9rem;
}
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---- CHAT ---- */
.chat-container { display: flex; height: calc(100vh - 145px); }
.chat-list { width: 300px; border-right: 1px solid var(--border); overflow-y: auto; }
.chat-item { padding: 1rem; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; gap: 0.8rem; align-items: center; }
.chat-item:hover { background: var(--primary-light); }
.chat-item img { width: 45px; height: 45px; border-radius: 50%; object-fit: cover; }
.chat-window { flex: 1; display: flex; flex-direction: column; }
.chat-messages { flex: 1; padding: 1.5rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; }
.message-bubble { max-width: 60%; padding: 0.7rem 1rem; border-radius: 12px; font-size: 0.9rem; }
.message-bubble.sent { background: var(--primary); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.message-bubble.received { background: #f0f0f0; align-self: flex-start; border-bottom-left-radius: 4px; }
.chat-input { padding: 1rem; border-top: 1px solid var(--border); display: flex; gap: 0.8rem; }
.chat-input input { flex: 1; }

/* Admin Menu Toggle Button */
.admin-menu-toggle {
    display: none;
}

/* ---- RESPONSIVE ---- */

/* Dashboard profile grids - 4 per row on desktop */
#matches-grid,
.card-body > div[style*="grid-template-columns:repeat(4,1fr)"] {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

/* Tablet (768px - 1100px) */
@media (min-width: 769px) and (max-width: 1100px) {
    /* Dashboard profile grids - 2 per row on tablet */
    #matches-grid,
    .card-body > div[style*="grid-template-columns:repeat(4,1fr)"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* .grid-4 also becomes 2 columns on tablet */
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    
    /* Features section - 2 columns on tablet */
    section div[style*="grid-template-columns:repeat(3,1fr)"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* PWA section - keep 2 columns but reduce gap */
    section div[style*="grid-template-columns:1fr 1fr"] {
        gap: 2rem !important;
    }
    
    .main-content { padding: 1.5rem; }
    .stats-bar { gap: 2rem; }
}

/* Mobile (max 768px) */
@media (max-width: 768px) {
    /* Dashboard profile grids - 1 per row on mobile */
    #matches-grid,
    .card-body > div[style*="grid-template-columns:repeat(4,1fr)"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Grids */
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    
    /* Features section - 1 column on mobile */
    section div[style*="grid-template-columns:repeat(3,1fr)"] {
        grid-template-columns: 1fr !important;
    }
    
    /* PWA section - stack on mobile */
    section div[style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }

    /* Navbar */
    .navbar { padding: 0 1rem; height: auto; min-height: 70px; flex-wrap: wrap; gap: 0.5rem; }
    .navbar .logo { font-size: 1.4rem; }
    .navbar .logo img { height: 55px !important; max-width: 220px !important; }
    .nav-links { gap: 0.6rem; flex-wrap: wrap; justify-content: flex-end; }
    .nav-links a { font-size: 0.8rem; }
    .nav-links .btn-nav { padding: 0.3rem 0.8rem; font-size: 0.8rem; }

    /* Layout */
    .layout { flex-direction: column; }
    
    /* User sidebar on mobile - Horizontal Scrollable Pills */
    .user-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 0.6rem 1rem;
        display: flex;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 0.6rem;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        background: #fff !important;
        position: sticky;
        top: 70px;
        z-index: 900;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
        height: auto !important;
    }
    .user-sidebar::-webkit-scrollbar {
        display: none;
    }
    .user-sidebar {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    .user-sidebar .menu-item {
        padding: 0.5rem 1rem !important;
        font-size: 0.82rem;
        border-left: none !important;
        border-bottom: none !important;
        white-space: nowrap;
        flex-shrink: 0;
        border-radius: 20px;
        background: #f5f6fa;
        color: var(--text-dark) !important;
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        font-weight: 500;
        transition: all 0.2s ease;
    }
    .user-sidebar .menu-item:hover,
    .user-sidebar .menu-item.active {
        background: var(--primary) !important;
        color: #fff !important;
        border-bottom-color: transparent !important;
    }
    .user-sidebar .ad-container {
        display: none !important;
    }
    .user-sidebar hr {
        display: none !important;
    }

    /* Admin sidebar on mobile - Slide-out Drawer */
    .admin-sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px !important;
        height: 100vh !important;
        z-index: 9999 !important;
        background: var(--sidebar-bg) !important;
        box-shadow: 4px 0 25px rgba(0,0,0,0.15);
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        border-right: 1px solid var(--border);
        border-bottom: none !important;
        padding: 1.5rem 0 !important;
    }
    .admin-sidebar.open {
        transform: translateX(0);
    }
    .admin-sidebar .menu-item {
        padding: 0.8rem 1.5rem !important;
        font-size: 0.95rem;
        border-left: 3px solid transparent !important;
        border-bottom: none !important;
        white-space: nowrap;
        display: flex;
        align-items: center;
        gap: 0.8rem;
    }
    .admin-sidebar .menu-item:hover,
    .admin-sidebar .menu-item.active {
        background: var(--primary-light) !important;
        color: var(--primary) !important;
        border-left-color: var(--primary) !important;
        border-bottom-color: transparent !important;
    }

    /* Mobile Sidebar Backdrop Overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
        z-index: 9998;
        transition: opacity 0.3s ease;
    }
    .sidebar-overlay.active {
        display: block;
    }

    /* Mobile Floating Menu Toggle Button */
    .admin-menu-toggle {
        display: flex;
        position: fixed;
        bottom: 24px;
        right: 24px;
        background: var(--primary);
        color: #fff;
        border: none;
        border-radius: 50px;
        padding: 0.8rem 1.5rem;
        font-weight: 700;
        box-shadow: 0 6px 20px rgba(192,57,43,0.3);
        z-index: 9997;
        cursor: pointer;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.95rem;
        letter-spacing: 0.5px;
        transition: all 0.2s ease;
        font-family: inherit;
    }
    .admin-menu-toggle:hover {
        background: var(--primary-dark);
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(192,57,43,0.4);
    }
    .admin-menu-toggle:active {
        transform: translateY(0);
    }
    .main-content { padding: 1rem; }

    /* Hero */
    .hero { padding: 3rem 1rem; }
    .hero h1 { font-size: 1.8rem; }
    .hero p { font-size: 1rem; }

    /* Stats */
    .stats-bar { flex-wrap: wrap; gap: 1.5rem; padding: 1.5rem 1rem; }

    /* Cards */
    .card-body { padding: 1rem; }
    .card-header { padding: 0.9rem 1rem; font-size: 1rem; }

    /* Profile cards */
    .profile-card img { height: 180px; }

    /* Chat */
    .chat-container { flex-direction: column; height: auto; }
    .chat-list { width: 100%; max-height: 200px; border-right: none; border-bottom: 1px solid var(--border); }
    .chat-window { min-height: 400px; }
    .chat-messages { min-height: 300px; }
    .message-bubble { max-width: 85%; }

    /* Tables — horizontal scroll on mobile */
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table { font-size: 0.82rem; min-width: 500px; }
    .table th, .table td { padding: 0.6rem 0.7rem; }

    /* Buttons */
    .btn { padding: 0.5rem 1.1rem; font-size: 0.88rem; }
    .btn-sm { padding: 0.3rem 0.7rem; font-size: 0.78rem; }

    /* Forms */
    .form-control { font-size: 0.9rem; padding: 0.6rem 0.8rem; }

    /* Subscription plan badges */
    .plan-card { margin-top: 18px; }

    /* Admin sidebar on mobile is managed via .admin-sidebar and floating toggle button rules above */

    /* Payment gateway cards — 2 per row on mobile */
    .gw-cards-wrap { display: grid !important; grid-template-columns: repeat(2, 1fr) !important; }
    .gw-cards-wrap label { min-width: unset !important; flex: unset !important; }

    /* Card header links — stack on mobile */
    .card-header a[style*="float:right"] {
        float: none !important;
        display: block;
        margin-top: 0.3rem;
        font-size: 0.78rem;
    }

    /* PWA install banner — compact on mobile */
    #pwa-install-banner { padding: 0.7rem 0.8rem !important; }

    /* Biodata modal full-screen on mobile */
    .pay-box { max-width: 100% !important; margin: 0 !important; border-radius: 12px 12px 0 0 !important; }
    .pay-modal { align-items: flex-end !important; padding: 0 !important; }

    /* Stats bar wrap on mobile */
    .stats-bar { gap: 1rem !important; padding: 1rem !important; }
    .stat-item .number { font-size: 1.5rem; }
}

@media (max-width: 480px) {
    .navbar .logo { font-size: 1.2rem; }
    .navbar .logo img { height: 48px !important; max-width: 180px !important; }
    .nav-links { gap: 0.4rem; }
    .nav-links a { font-size: 0.75rem; }
    .hero h1 { font-size: 1.5rem; }
    .hero p { font-size: 0.9rem; }
    .main-content { padding: 0.8rem; }
    .card-body { padding: 0.8rem; }
    .profile-card img { height: 160px; }
    .chat-list { max-height: 160px; }
    .message-bubble { max-width: 92%; font-size: 0.85rem; }
    /* Stack action buttons vertically on very small screens */
    .profile-card .profile-actions { flex-wrap: wrap; }
    /* Payment gateway cards — 1 per row on very small screens */
    .gw-cards-wrap { grid-template-columns: 1fr !important; }
    /* Subscription grid — 1 col */
    .grid-4 { grid-template-columns: 1fr; }
}
