/* ============================================
   ChitChat Pakistan - Main Stylesheet
   WhatsApp + Facebook Inspired Design
   ============================================ */

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

/* --- CSS Variables (Theme Colors) --- */
:root {
    /* WhatsApp Inspired Colors */
    --primary: #075E54;
    --primary-dark: #054C44;
    --primary-light: #128C7E;
    --secondary: #25D366;
    --accent: #34B7F1;
    
    /* Chat Colors */
    --chat-bg: #ECE5DD;
    --msg-sent: #DCF8C6;
    --msg-received: #FFFFFF;
    
    /* UI Colors */
    --bg-main: #F0F2F5;
    --bg-white: #FFFFFF;
    --bg-card: #FFFFFF;
    --text-primary: #111B21;
    --text-secondary: #667781;
    --text-light: #8696A0;
    --border: #E9EDEF;
    
    /* Status Colors */
    --online: #31A24C;
    --warning: #F5A623;
    --danger: #EA0038;
    --info: #0099FF;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.12);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.15);
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 50%;
    
    /* Transitions */
    --transition: all 0.3s ease;
}

/* --- Dark Mode Variables --- */
[data-theme="dark"] {
    --chat-bg: #0B141A;
    --msg-sent: #005C4B;
    --msg-received: #202C33;
    --bg-main: #111B21;
    --bg-white: #1F2C33;
    --bg-card: #1F2C33;
    --text-primary: #E9EDEF;
    --text-secondary: #8696A0;
    --text-light: #667781;
    --border: #2A373F;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

a:hover {
    text-decoration: underline;
}

/* --- Loading Screen --- */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-screen p {
    color: white;
    font-size: 1.2rem;
    font-weight: 500;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

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

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

.btn-google {
    background: white;
    color: #3C4043;
    border: 1px solid var(--border);
    font-weight: 500;
}

.btn-google:hover {
    background: #F8F9FA;
    border-color: #DADCE0;
}

.google-icon {
    font-weight: 700;
    color: #4285F4;
    font-size: 1.2rem;
}

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

.btn-guest:hover {
    background: #20BD5A;
}

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

.btn-danger:hover {
    background: #CC0030;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    width: auto;
}

/* --- Input Groups --- */
.input-group {
    margin-bottom: 15px;
    position: relative;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    color: var(--text-primary);
    transition: var(--transition);
    font-family: inherit;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(7,94,84,0.1);
}

.password-group {
    position: relative;
}

.password-group input {
    padding-right: 45px;
}

.toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    opacity: 0.6;
}

.toggle-password:hover {
    opacity: 1;
}

/* --- Checkbox --- */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.checkbox-group a {
    color: var(--primary-light);
    font-weight: 500;
}

/* --- Error Message --- */
.error-message {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 8px;
    min-height: 20px;
    text-align: center;
}

/* --- Divider --- */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 20px 0;
    color: var(--text-light);
    font-size: 0.85rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.divider span {
    padding: 0 15px;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    html {
        font-size: 15px;
    }
    
    .btn {
        padding: 10px 20px;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
}