:root {
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-secondary: #f1f5f9;
    --color-text: #1e293b;
    --color-text-light: #64748b;
    --color-bg: #f8fafc;
    --color-white: #ffffff;
    --color-danger: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 12px;
}

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

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Header */
.main-header {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-secondary);
    height: 80px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--color-primary), #60a5fa);
    border-radius: 10px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 22px;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.logo-text {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-link {
    text-decoration: none;
    color: var(--color-text-light);
    font-weight: 600;
    font-size: 15px;
    transition: color 0.3s;
}

.nav-link:hover, .nav-link.active {
    color: var(--color-primary);
}

.auth-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
    padding: 10px 24px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--color-secondary);
    color: var(--color-text);
    padding: 10px 24px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

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

/* Hero */
.hero {
    padding: 100px 0;
    background: radial-gradient(circle at 80% 20%, rgba(37, 99, 235, 0.05) 0%, transparent 40%),
                radial-gradient(circle at 20% 80%, rgba(37, 99, 235, 0.05) 0%, transparent 40%);
}

.hero-content {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.hero-content h1 {
    font-size: 48px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 24px;
    color: #0f172a;
}

.hero-content p {
    font-size: 18px;
    color: var(--color-text-light);
    margin-bottom: 40px;
}

.search-bar {
    background: white;
    padding: 8px;
    border-radius: 60px;
    display: flex;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-secondary);
}

.search-bar input {
    flex: 1;
    border: none;
    padding: 0 30px;
    font-size: 16px;
    font-family: inherit;
    outline: none;
    background: transparent;
}

.search-bar button {
    background-color: var(--color-primary);
    color: white;
    border: none;
    padding: 14px 35px;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.3s;
}

/* Listings Grid */
.listings-section {
    padding-bottom: 100px;
}

.section-header {
    margin-bottom: 40px;
}

.section-title {
    font-size: 28px;
    font-weight: 800;
}

.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

/* Card Style */
.listing-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--color-secondary);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

.listing-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
}

.card-content {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.author-avatar {
    width: 36px;
    height: 36px;
    background-color: var(--color-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--color-primary);
}

.author-name {
    font-weight: 700;
    font-size: 14px;
}

.listing-text {
    font-size: 16px;
    color: var(--color-text);
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.6;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #f8fafc;
}

.listing-date {
    font-size: 12px;
    color: var(--color-text-light);
}

.btn-view {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* States */
.loading-state, .error-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 100px 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(37, 99, 235, 0.1);
    border-top: 4px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden { display: none !important; }

/* CTAs */
.login-cta {
    margin-top: 60px;
    text-align: center;
}

.cta-card {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    padding: 50px;
    border-radius: 30px;
    border: 1px solid #bfdbfe;
}

.cta-card h3 {
    font-size: 24px;
    margin-bottom: 12px;
}

.cta-card p {
    color: var(--color-text-light);
    margin-bottom: 30px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* Footer */
.main-footer {
    padding: 60px 0;
    border-top: 1px solid var(--color-secondary);
    color: var(--color-text-light);
}

/* User Profile Mini */
.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 15px;
    background-color: var(--color-secondary);
    border-radius: 50px;
    text-decoration: none;
    color: inherit;
    font-weight: 700;
    font-size: 14px;
    transition: background 0.3s;
}

.user-pill:hover {
    background-color: #e2e8f0;
}

.logout-link {
    font-size: 12px;
    color: var(--color-danger);
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
}

/* Auth Page */
.auth-container {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-card {
    background: white;
    width: 100%;
    max-width: 450px;
    padding: 50px;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-secondary);
}

.auth-card h2 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
    text-align: center;
}

.auth-subtitle {
    text-align: center;
    color: var(--color-text-light);
    margin-bottom: 40px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px 20px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: border-color 0.3s;
}

.form-group input:focus {
    border-color: var(--color-primary);
}

.auth-btn {
    width: 100%;
    margin-top: 10px;
}

.auth-switch {
    margin-top: 30px;
    text-align: center;
    font-size: 14px;
    color: var(--color-text-light);
}

.auth-switch a {
    color: var(--color-primary);
    font-weight: 700;
    text-decoration: none;
}

@media (max-width: 768px) {
    .hero-content h1 { font-size: 32px; }
    .main-nav { gap: 15px; }
    .nav-link { display: none; }
    .nav-link.active { display: block; }
    .hero { padding: 60px 0; }
    .auth-card { padding: 30px; }
}
