
/* ===== JustRecord.me Premium Design System ===== */

:root {
    /* Colors */
    --bg-dark: #1b1d21;
    --bg-surface: #2a2c32;
    --bg-card: rgba(42, 44, 50, 0.6);
    --primary: #03dac6;
    --primary-glow: rgba(3, 218, 198, 0.4);
    --secondary: #42a5f5;
    --accent: #ffb74d;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-glass: rgba(255, 255, 255, 0.08);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Effects */
    --glass-blur: blur(12px);
    --shadow-premium: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Layout */
    --sidebar-width: 250px;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    overflow-x: hidden;
}

/* Background Gradients */
.bg-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    filter: blur(80px);
    opacity: 0.4;
    animation: move 20s infinite alternate;
}

.blob-1 { top: -100px; right: -100px; background: radial-gradient(circle, rgba(139, 92, 246, 0.3) 0%, transparent 70%); }
.blob-2 { bottom: -100px; left: -100px; }

@keyframes move {
    from { transform: translate(0, 0); }
    to { transform: translate(100px, 100px); }
}

/* Glassmorphism */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    box-shadow: var(--shadow-premium);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-8px);
    transition: var(--transition);
}

/* Buttons */
.btn-premium {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    gap: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    box-shadow: 0 10px 20px -5px var(--primary-glow);
}

.btn-primary:hover {
    box-shadow: 0 15px 30px -5px var(--primary-glow);
    transform: scale(1.02);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-main);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
}

/* Typography */
.gradient-text {
    background: linear-gradient(135deg, #fff 30%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h1 { font-size: 4rem; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 2.5rem; font-weight: 700; }
p.muted { color: var(--text-muted); }

/* Inputs */
.premium-input {
    width: 100%;
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    color: white;
    outline: none;
    transition: var(--transition);
}

.search-box {
    position: relative;
    flex: 1;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-box .premium-input {
    padding-left: 45px;
}

.premium-input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

select.premium-input option {
    background-color: #0f172a;
    color: white;
}

/* Utils */
.flex-center { display: flex; align-items: center; justify-content: center; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* Dashboard & App Layout */
.app-body {
    padding: 0;
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-dark);
}

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    z-index: 100;
    flex-shrink: 0;
}

.sidebar-logo {
    margin-bottom: 40px;
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.sidebar-nav { 
    flex-grow: 1; 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
}

/* Custom scrollbar for sidebar nav */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}
.sidebar-link {
    padding: 12px 18px;
    border-radius: 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: var(--transition);
}

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

.sidebar-link:hover, .sidebar-link.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.sidebar-link.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), transparent);
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.3);
}

.sidebar-section {
    margin-top: 30px;
    margin-bottom: 10px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.3);
    padding-left: 18px;
}

.main-container {
    flex-grow: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    background: rgba(15, 23, 42, 0.95);
}

.header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    background: transparent;
    padding: 25px 40px;
    position: relative;
    z-index: 100;
}

.inner-content {
    flex-grow: 1;
    padding: 40px;
    overflow-y: auto;
    background: var(--bg-dark);
    border-top-left-radius: 30px;
    border-left: 1px solid rgba(255, 255, 255, 0.03);
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.page-title { font-size: 28px; font-weight: 800; margin-bottom: 30px; }

/* ===== Mobile & PWA Enhancements ===== */

/* Mobile Header - hidden on desktop, shown via media query on mobile */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(60px + env(safe-area-inset-top, 0px));
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border-glass);
    z-index: 1000;
    padding-left: 20px;
    padding-right: 20px;
    grid-template-columns: auto auto;
    grid-template-rows: 60px;
    align-items: center;
    justify-content: space-between;
    display: none; /* Hidden on desktop by default */
}

.mobile-header > * {
    height: 60px;
    display: flex;
    align-items: center;
}

.hamburger {
    font-size: 20px;
    color: white;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.hamburger:active {
    transform: scale(0.9);
    background: rgba(59, 130, 246, 0.2);
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1050;
}

.sidebar-overlay.active {
    display: block;
}

/* Pull to Refresh */
#ptr-spinner {
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 45px;
    height: 45px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.3s, transform 0.1s linear;
}

#ptr-spinner i {
    color: white;
    font-size: 18px;
}

.ptr-loading i {
    animation: ptr-spin 0.8s linear infinite;
}

@keyframes ptr-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    h1 { font-size: 2.5rem; }
    h2 { font-size: 1.8rem; }
}

@media (max-width: 768px) {
    /* Release the overflow clip so fixed elements receive events */
    .app-body {
        overflow-y: auto !important;
        height: auto !important;
        min-height: 100vh;
    }

    /* Hide desktop sidebar entirely on mobile — app pages only */
    .app-body .sidebar {
        display: none !important;
    }

    /* Hide the desktop header bar — app pages only */
    .app-body .header {
        display: none !important;
    }

    .main-container {
        margin-left: 0 !important;
        width: 100% !important;
        height: auto !important;
        min-height: 100vh;
        padding-top: calc(60px + env(safe-area-inset-top, 0px)) !important;
    }

    .inner-content {
        overflow-y: visible !important;
        padding: 25px 15px 40px 15px !important;
        border-top-left-radius: 0 !important;
    }

    /* Show mobile header */
    .mobile-header {
        display: flex;
        z-index: 1099 !important;
    }

    .dashboard-controls {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-bottom: 25px;
    }
    
    .controls-main-row {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
    }
    
    .controls-filter-row {
        display: flex;
        gap: 10px;
        width: 100%;
    }
    
    .controls-filter-row select {
        flex: 1;
        min-width: 0;
    }

    .search-box {
        max-width: none !important;
    }

    .search-box i {
        display: none !important;
    }

    .search-box .premium-input {
        padding-left: 20px !important;
    }

    .modal-content {
        padding: 25px 20px !important;
    }

    /* Mobile-only Create Button logic */
    .create-btn-mobile {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        font-size: 18px !important;
        position: relative;
        overflow: hidden;
    }
    
    .create-btn-mobile span {
        display: none !important;
    }
    
    .create-btn-mobile i {
        margin-right: 0 !important;
    }
}

/* ===== Footer Redesign ===== */
.footer {
    padding: 80px 0 40px;
    border-top: 1px solid var(--border-glass);
    margin-top: 100px;
    background: linear-gradient(to bottom, transparent, rgba(15, 23, 42, 0.5));
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr repeat(4, 1fr);
    gap: 60px;
    margin-bottom: 60px;
}

.footer-col h4 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 25px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: white;
}

.footer-col ul {
    list-style: none;
    padding: 0;
}

.footer-col ul li {
    margin-bottom: 12px;
}

.footer-col ul li a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 15px;
    transition: var(--transition);
}

.footer-col ul li a:hover {
    color: var(--primary);
    padding-left: 5px;
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.social-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: var(--transition);
}

.social-icon:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateY(-5px);
}

/* Newsletter Section */
.footer-middle {
    padding: 40px 0;
    border-top: 1px solid var(--border-glass);
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 40px;
}

.newsletter-box h4 {
    margin-bottom: 20px;
    font-size: 18px;
}

.newsletter-form {
    display: flex;
    gap: 10px;
    max-width: 400px;
}

.platform-links {
    display: flex;
    gap: 30px;
}

.platform-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.platform-link i {
    font-size: 20px;
}

.platform-link:hover {
    color: white;
}

/* Footer Bottom */
.footer-bottom {
    text-align: center;
}

.footer-disclaimer {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.8;
    max-width: 900px;
    margin: 0 auto 30px;
}

.footer-copyright {
    font-size: 13px;
    color: var(--text-muted);
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

@media (max-width: 1024px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 40px;
    }
    .footer-col:first-child {
        grid-column: span 2;
        margin-bottom: 20px;
    }
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }
    .footer-col:first-child {
        grid-column: span 1;
    }
    .footer-middle {
        flex-direction: column;
        align-items: flex-start;
    }
    .newsletter-form {
        flex-direction: column !important;
        width: 100% !important;
        gap: 15px !important;
    }
    .newsletter-form .premium-input,
    .newsletter-form .btn-premium {
        width: 100% !important;
    }
    .platform-links {
        flex-direction: column !important;
        gap: 20px !important;
        width: 100% !important;
    }
    .platform-link {
        width: 100% !important;
        padding: 10px 0 !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    }
}

/* ===== Skeleton Loading System ===== */
@keyframes skeleton-pulse {
    0% { opacity: 0.5; }
    50% { opacity: 0.8; }
    100% { opacity: 0.5; }
}

.skeleton {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 25px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skeleton-line {
    height: 12px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
}

.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 70%; }
.skeleton-line.long { width: 100%; }

.skeleton-title {
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    width: 30%;
    margin-bottom: 5px;
}

/* ===== Feed & Onboarding Cards ===== */
.feed-section {
    margin-bottom: 30px;
}

.feed-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.feed-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.onboarding-card {
    display: flex;
    padding: 25px;
    gap: 30px;
    margin-bottom: 20px;
    transition: var(--transition);
    cursor: default;
}

.onboarding-card:hover {
    transform: none;
    border-color: var(--border-glass);
}

.onboarding-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

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

.author-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border: 1px solid var(--border-glass);
}

.onboarding-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.onboarding-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #fff;
}

.onboarding-summary {
    font-size: 14px;
    color: var(--text-main);
    line-height: 1.6;
    margin-bottom: 10px;
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

.onboarding-summary.collapsed {
    max-height: 44px; /* Show roughly 2 lines */
    mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
}

.show-more-btn {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-align: left;
    margin-top: 5px;
    transition: var(--transition);
}

.show-more-btn:hover {
    text-decoration: underline;
}

.onboarding-preview {
    width: 240px;
    height: 150px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-glass);
    flex-shrink: 0;
}

.onboarding-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.onboarding-footer {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-glass);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .onboarding-card {
        flex-direction: column-reverse;
        padding: 20px;
        gap: 20px;
    }
    
    .onboarding-preview {
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
    }
}
