/**
 * Skooby Chat - Main Stylesheet
 * Complete design system based on documentation
 */

/* =====================================================
   1. CSS VARIABLES & THEME
   ===================================================== */

:root {
    /* Primary Colors */
    --primary-blue: #1DA1F2;
    --secondary-cyan: #00D9FF;
    --tertiary-teal: #14B8A6;
    
    /* Light Mode Colors */
    --bg-primary: #F5F5F5;
    --bg-secondary: #FFFFFF;
    --bg-card: #FFFFFF;
    --text-primary: #000000;
    --text-secondary: #8B8B8B;
    --text-muted: #9CA3AF;
    --border-color: #E5E7EB;
    --shadow: rgba(0, 0, 0, 0.1);
    
    /* Status Colors */
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;
    --info: #3B82F6;
    
    /* Typography */
    --font-family: 'Inter', 'Segoe UI', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --spacing-xl: 24px;
    --spacing-2xl: 32px;
    --spacing-3xl: 48px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.1);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-primary: #000000;
    --bg-secondary: #0B1A23;
    --bg-card: #0D2535;
    --text-primary: #FFFFFF;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    --border-color: #1F2937;
    --shadow: rgba(0, 0, 0, 0.3);
}

/* =====================================================
   2. RESET & BASE STYLES
   ===================================================== */

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

a:hover {
    color: var(--secondary-cyan);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
}

input, textarea, select {
    font-family: inherit;
}

/* =====================================================
   3. TYPOGRAPHY
   ===================================================== */

h1 { font-size: 42px; font-weight: 700; line-height: 1.2; }
h2 { font-size: 32px; font-weight: 600; line-height: 1.3; }
h3 { font-size: 24px; font-weight: 600; line-height: 1.4; }
h4 { font-size: 20px; font-weight: 600; line-height: 1.4; }
h5 { font-size: 18px; font-weight: 600; line-height: 1.5; }
h6 { font-size: 16px; font-weight: 600; line-height: 1.5; }

.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 18px; }
.text-2xl { font-size: 24px; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }

/* =====================================================
   4. BUTTONS
   ===================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.btn-primary {
    background: var(--primary-blue);
    color: #FFFFFF;
    box-shadow: 0 2px 8px rgba(29, 161, 242, 0.25);
}

.btn-primary:hover {
    background: #1A8CD8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(29, 161, 242, 0.35);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-full);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* =====================================================
   5. CARDS
   ===================================================== */

.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.card-body {
    padding: var(--spacing-lg);
}

.card-footer {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

/* =====================================================
   6. FORMS
   ===================================================== */

.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--transition-base);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(29, 161, 242, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

/* =====================================================
   7. NAVIGATION
   ===================================================== */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 8px 0;
    z-index: 1000;
}

.bottom-nav-content {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 768px;
    margin: 0 auto;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px;
    color: var(--text-secondary);
    transition: color var(--transition-base);
    position: relative;
}

.nav-item.active {
    color: var(--primary-blue);
}

.nav-item:hover {
    color: var(--primary-blue);
}

.nav-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.nav-label {
    font-size: 11px;
    font-weight: 500;
}

.nav-badge {
    position: absolute;
    top: 4px;
    right: 8px;
    background: var(--error);
    color: #FFFFFF;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    min-width: 18px;
    text-align: center;
}

/* =====================================================
   8. PROFILE IMAGES
   ===================================================== */

.avatar {
    border-radius: var(--radius-full);
    object-fit: cover;
}

.avatar-xs { width: 24px; height: 24px; }
.avatar-sm { width: 32px; height: 32px; }
.avatar-md { width: 40px; height: 40px; }
.avatar-lg { width: 56px; height: 56px; }
.avatar-xl { width: 80px; height: 80px; }
.avatar-2xl { width: 120px; height: 120px; }

.avatar-ring {
    padding: 3px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-cyan) 100%);
    border-radius: var(--radius-full);
}

.avatar-ring img {
    border: 3px solid var(--bg-card);
    border-radius: var(--radius-full);
}

/* =====================================================
   9. POST CARD
   ===================================================== */

.post-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
}

.post-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
}

.post-author {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.post-author-info h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.post-author-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

.post-menu-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    padding: 4px 8px;
}

.post-content {
    margin-bottom: var(--spacing-md);
}

.post-text {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: var(--spacing-md);
}

.post-image {
    border-radius: var(--radius-md);
    width: 100%;
    max-height: 500px;
    object-fit: cover;
}

.post-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-xl);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

.post-action {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    transition: color var(--transition-base);
}

.post-action:hover {
    color: var(--primary-blue);
}

.post-action.liked {
    color: var(--error);
}

.post-action.bookmarked {
    color: var(--primary-blue);
}

/* =====================================================
   10. STORY CIRCLE
   ===================================================== */

.stories-container {
    display: flex;
    gap: var(--spacing-lg);
    padding: var(--spacing-lg) 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.stories-container::-webkit-scrollbar {
    display: none;
}

.story-circle {
    flex-shrink: 0;
    text-align: center;
}

.story-ring {
    width: 68px;
    height: 68px;
    border-radius: var(--radius-full);
    padding: 3px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-cyan) 100%);
    margin-bottom: var(--spacing-sm);
}

.story-ring.viewed {
    background: var(--border-color);
}

.story-ring img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    border: 3px solid var(--bg-card);
    object-fit: cover;
}

.story-name {
    font-size: 11px;
    color: var(--text-secondary);
    max-width: 68px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =====================================================
   11. UTILITY CLASSES
   ===================================================== */

.container {
    width: 100%;
    max-width: 768px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }

.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.hidden { display: none; }
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }

/* =====================================================
   12. ANIMATIONS
   ===================================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.fade-in { animation: fadeIn 0.3s ease; }
.slide-up { animation: slideUp 0.3s ease; }
.scale-in { animation: scaleIn 0.3s ease; }

/* =====================================================
   13. RESPONSIVE
   ===================================================== */

@media (max-width: 768px) {
    h1 { font-size: 32px; }
    h2 { font-size: 24px; }
    h3 { font-size: 20px; }
    
    .container {
        padding: 0 var(--spacing-md);
    }
}

@media (max-width: 480px) {
    h1 { font-size: 24px; }
    h2 { font-size: 20px; }
    h3 { font-size: 18px; }
}

/* =====================================================
   14. LOADING SPINNER
   ===================================================== */

.spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-blue);
    border-radius: var(--radius-full);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

/* =====================================================
   15. MODAL
   ===================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: scaleIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
}

/* =====================================================
   END OF STYLESHEET
   ===================================================== */
