/* Project: SindhWork (SW) - Professional Premium UI
   Author: Ikram Ul Haque
   Fix: Profile Image Aspect Ratio & Size Stability
*/

:root { 
    --primary: #00aeef; 
    --secondary: #bd0000; 
    --dark: #0f172a; 
    --light: #f8fafc; 
    --shadow: 0 15px 35px rgba(0, 0, 0, 0.1); 
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Outfit', sans-serif; 
}

body { 
    background: #f4f7f6; 
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Header & Logo --- */
header { 
    background: #fff; 
    padding: 15px 0 10px 0; 
    text-align: center;
    border-bottom: 1px solid #eee;
}

.logo { 
    font-size: 2.2rem; 
    font-weight: 800; 
    margin-bottom: 10px; 
    color: var(--dark);
    letter-spacing: -1px;
}

.logo span { color: var(--primary); }
.logo i { color: var(--secondary); margin-right: 8px; }

/* --- Trapezoid Navigation --- */
nav { 
    background: var(--secondary); 
    display: flex; 
    justify-content: center; 
    gap: 2rem; 
    padding: 12px; 
    clip-path: polygon(0 0, 100% 0, 98% 100%, 2% 100%); 
    max-width: 850px; 
    margin: 0 auto; 
    box-shadow: 0 8px 15px rgba(189, 0, 0, 0.15);
}

nav a { 
    color: #fffb00; 
    text-decoration: none; 
    font-weight: 700; 
    font-size: 0.95rem;
    text-transform: uppercase;
    transition: 0.3s;
}

nav a:hover { color: #fff; transform: translateY(-2px); }

/* --- Main Layout & Containers --- */
.container { 
    flex: 1;
    display: flex;
    align-items: flex-start; 
    justify-content: center; 
    padding: 25px 20px; 
}

/* Market Layout (Main + Sidebar) */
.market-flex-container {
    display: flex;
    gap: 30px;
    width: 100%;
    max-width: 1200px;
}

.market-main { flex: 3; order: 1; text-align: center; }
.market-sidebar { flex: 1; order: 2; text-align: left; }

.main-wall { 
    width: 100%;
    background: #fff; 
    padding: 35px; 
    border-radius: 25px; 
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.05);
}

.section-title { 
    font-size: 2.2rem; 
    font-weight: 900; 
    margin-bottom: 8px; 
    color: var(--dark); 
}

.sub-heading { 
    color: #64748b; 
    margin-bottom: 30px; 
    font-size: 1.1rem; 
}

/* --- Profile Widget Design (FIXED IMAGE) --- */
.profile-widget {
    text-align: center;
    width: 100%;
}

.avatar-container { 
    margin-bottom: 15px; 
    display: flex;
    justify-content: center;
}

.avatar {
    width: 100px; 
    height: 100px; 
    min-width: 100px; /* Fixed width */
    min-height: 100px; /* Fixed height */
    max-width: 100px;
    max-height: 100px;
    border-radius: 50%;
    object-fit: cover; /* Keeps image from stretching */
    border: 3px solid var(--primary);
    padding: 4px; 
    background: #fff;
    display: block;
}

.profile-widget h3 { font-size: 1.4rem; font-weight: 800; color: var(--dark); margin-bottom: 5px; }

.user-id {
    display: inline-block; font-size: 0.85rem; color: #64748b;
    font-weight: 600; background: #f1f5f9; padding: 3px 12px;
    border-radius: 20px; margin-bottom: 20px;
}

.token-display {
    background: #f8fafc; border-radius: 15px; padding: 15px;
    margin-bottom: 20px; border: 1px solid #edf2f7;
}

.token-label { display: block; font-size: 0.75rem; color: #94a3b8; text-transform: uppercase; font-weight: 700; margin-bottom: 5px; }
.token-value { font-size: 1.6rem; font-weight: 800; color: var(--dark); }
.token-value i { color: #ffb100; }

/* Widget Buttons */
.notif-btn, .setting-btn, .logout-btn {
    display: flex; align-items: center; justify-content: center;
    gap: 12px; padding: 12px; border-radius: 12px;
    text-decoration: none; font-weight: 700; font-size: 0.95rem;
    margin-bottom: 10px; transition: 0.3s ease;
}

.notification-icon-box { position: relative; font-size: 1.1rem; }
.bell-badge {
    position: absolute; top: -5px; right: -8px; background: var(--secondary);
    color: white; font-size: 0.65rem; width: 18px; height: 18px;
    border-radius: 50%; display: flex; align-items: center; 
    justify-content: center; border: 2px solid #fff;
}

.notif-btn { background: #f0f9ff; color: var(--primary); }
.notif-btn:hover { background: var(--primary); color: #fff; }
.setting-btn { background: #f1f5f9; color: var(--dark); }
.setting-btn:hover { background: var(--dark); color: #fff; }
.logout-btn { background: #fff1f2; color: var(--secondary); }
.logout-btn:hover { background: var(--secondary); color: #fff; }

/* --- Grid & Cards --- */
.grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); 
    gap: 25px; 
}

.card { 
    background: #fff; 
    border-radius: 18px; 
    padding: 25px; 
    transition: 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    border: 2px solid #f1f5f9;
    text-align: left;
}

.card:hover { transform: translateY(-8px); border-color: var(--primary); }

.card::before {
    content: ''; position: absolute; top: 0; left: 50%;
    transform: translateX(-50%); width: 50px; height: 4px;
    background: var(--secondary); border-radius: 0 0 8px 8px;
}


.buy-now { 
    width: 100%; 
    background: linear-gradient(135deg, var(--primary), #008ecc); 
    color: white; padding: 14px; border-radius: 10px; 
    font-weight: 700; text-decoration: none; 
    display: flex; justify-content: center; 
    align-items: center; gap: 10px; margin-top: auto;
}

/* --- Footer --- */
footer { 
    padding: 20px; text-align: center; color: #94a3b8; 
    font-size: 0.85rem; background: #fff; border-top: 1px solid #eee;
}

/* --- Product Image Fix (600x350 Perfect Fit) --- */
.card-img { 
    width: 100%; 
    /* 600x350 ka exact ratio (1.71:1) */
    aspect-ratio: 600 / 350; 
    height: auto; 
    border-radius: 12px; 
    /* 'cover' hi rakhenge taake professional lage, lekin ab kuch katega nahi */
    object-fit: cover; 
    object-position: center; 
    margin-bottom: 15px; 
    display: block;
    background: #fff; /* Background white rakha hai */
    border: 1px solid #f1f5f9;
}

/* Hover Effect: Halka sa shadow aur brightness */
.card:hover .card-img {
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    filter: brightness(1.03);
}

/* --- Mobile Responsive (768px se niche) --- */
@media (max-width: 768px) {
    /* Side-by-side ko khatam karke upar-niche (Column) layout */
    .market-flex-container {
        flex-direction: column;
        gap: 20px;
    }

    /* Main content aur Sidebar dono ko poori width dena */
    .market-main, .market-sidebar {
        flex: unset;
        width: 100%;
    }

    /* Mobile par Profile Widget ko behtar dikhane ke liye order set karna */
    /* Agar aap chahte hain profile pehle dikhe, toh order: 1 kar dein */
    .market-sidebar {
        order: 2; 
    }
    .market-main {
        order: 1;
    }

    .grid { 
        grid-template-columns: 1fr; 
        gap: 20px; 
        padding: 0 5px;
    }

    .main-wall { padding: 20px 15px; }

    .card-img {
        aspect-ratio: 600 / 350; 
        margin-bottom: 12px;
    }
    
    .logo { font-size: 1.8rem; }

    /* Nav links ko mobile par wrap karna taake screen se bahar na jayen */
    nav { 
        gap: 0.5rem; 
        width: 100%; 
        flex-wrap: wrap; 
        padding: 10px 5px;
        clip-path: none; /* Mobile par simple rakha hai taake links na katen */
        border-radius: 10px;
    }

    nav a {
        font-size: 0.8rem;
    }
}