/**
 * App Pages Stylesheet
 *
 * Shared styles for non-interactive app pages (Grid, Login/Signup, etc.)
 * Based on home page space aesthetic but toned down - no heavy animations.
 */

/* ============================================================================
   Base App Page
   ========================================================================== */

.app-page {
    min-height: 100vh;
    background: radial-gradient(ellipse at top, #0a0e27 0%, #000000 100%);
    background-attachment: fixed;
    position: relative;
}

/* Static stars using pseudo-elements with box-shadow */
.app-page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    background: transparent;
    z-index: 0;
    box-shadow:
        /* Small white stars */
        100px 150px 0 0.5px rgba(255, 255, 255, 0.9),
        400px 280px 0 0.5px rgba(255, 255, 255, 0.8),
        650px 120px 0 0.5px rgba(255, 255, 255, 0.9),
        900px 80px 0 0.5px rgba(255, 255, 255, 0.7),
        1200px 200px 0 0.5px rgba(255, 255, 255, 0.8),
        200px 450px 0 0.5px rgba(255, 255, 255, 0.9),
        500px 350px 0 0.5px rgba(255, 255, 255, 0.7),
        800px 500px 0 0.5px rgba(255, 255, 255, 0.9),
        1100px 600px 0 0.5px rgba(255, 255, 255, 0.8),
        300px 80px 0 0.5px rgba(255, 255, 255, 0.7),
        700px 250px 0 0.5px rgba(255, 255, 255, 0.9),
        1000px 400px 0 0.5px rgba(255, 255, 255, 0.8),
        150px 600px 0 0.5px rgba(255, 255, 255, 0.9),
        450px 550px 0 0.5px rgba(255, 255, 255, 0.7),
        850px 150px 0 0.5px rgba(255, 255, 255, 0.8),
        1300px 350px 0 0.5px rgba(255, 255, 255, 0.9),
        250px 700px 0 0.5px rgba(255, 255, 255, 0.8),
        600px 650px 0 0.5px rgba(255, 255, 255, 0.7),
        950px 700px 0 0.5px rgba(255, 255, 255, 0.9),
        1250px 500px 0 0.5px rgba(255, 255, 255, 0.8),

        /* Medium stars */
        350px 200px 0 1px rgba(255, 255, 255, 0.9),
        750px 380px 0 1px rgba(255, 255, 255, 0.8),
        1150px 280px 0 1px rgba(255, 255, 255, 0.9),
        180px 520px 0 1px rgba(255, 255, 255, 0.7),
        580px 480px 0 1px rgba(255, 255, 255, 0.8),
        980px 320px 0 1px rgba(255, 255, 255, 0.9),
        420px 120px 0 1px rgba(255, 255, 255, 0.8),
        820px 620px 0 1px rgba(255, 255, 255, 0.7),

        /* Larger blue-tinted stars */
        550px 180px 0 1.5px rgba(74, 144, 217, 0.8),
        1050px 450px 0 1.5px rgba(108, 181, 255, 0.7),
        220px 320px 0 1.5px rgba(74, 144, 217, 0.8),
        720px 580px 0 1.5px rgba(108, 181, 255, 0.7),
        1320px 220px 0 1.5px rgba(74, 144, 217, 0.8);
}

/* Ensure content appears above stars */
.app-page > * {
    position: relative;
    z-index: 1;
}

/* ============================================================================
   Page Header Component
   ========================================================================== */

.page-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(45, 45, 45, 0.7);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(64, 64, 64, 0.5);
    z-index: 100;
}

.page-header-inner {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.2s;
}

.logo-link:hover {
    opacity: 0.8;
}

.logo {
    height: 26px;
    width: auto;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-name {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.user-name:hover {
    opacity: 0.7;
}

.header-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.header-btn-primary {
    background: rgba(74, 144, 217, 0.3);
    border-color: #4a90d9;
}

.header-btn-primary:hover {
    background: rgba(74, 144, 217, 0.5);
    border-color: #6cb5ff;
}

/* Add top padding to body when header is present */
.app-page {
    padding-top: 60px;
}

/* ============================================================================
   App Hero Section
   ========================================================================== */

.app-hero {
    padding: 60px 32px 40px;
    text-align: center;
    border-bottom: 1px solid rgba(64, 64, 64, 0.3);
    position: relative;
}

.app-hero h1,
.app-hero h2 {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #4a90d9 0%, #6cb5ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
}

.app-hero p {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 32px;
}

.app-hero-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    max-width: 700px;
    margin: 0 auto;
}

/* ============================================================================
   App Cards (Documents, Content Cards)
   ========================================================================== */

.app-card {
    background: rgba(45, 45, 45, 0.5);
    border: 1px solid rgba(64, 64, 64, 0.6);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.app-card:hover {
    border-color: rgba(74, 144, 217, 0.6);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(74, 144, 217, 0.15);
}

/* ============================================================================
   Document Grid
   ========================================================================== */

.document-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    padding: 32px;
    max-width: 1400px;
    margin: 0 auto;
}

.document-card {
    /* Inherits from .app-card styles when both classes are applied */
    background: rgba(45, 45, 45, 0.5);
    border: 1px solid rgba(64, 64, 64, 0.6);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    position: relative;
}

.document-card:hover {
    border-color: rgba(74, 144, 217, 0.6);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(74, 144, 217, 0.15);
}

/* ============================================================================
   Auth Pages (Login/Signup)
   ========================================================================== */

.auth-container {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    background: rgba(45, 45, 45, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(64, 64, 64, 0.6);
    border-radius: 16px;
    padding: 48px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #4a90d9 0%, #6cb5ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-header p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid rgba(64, 64, 64, 0.6);
}

.auth-footer p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.auth-footer a {
    color: #4a90d9;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.auth-footer a:hover {
    color: #6cb5ff;
    text-decoration: underline;
}

.back-link {
    display: inline-flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 13px;
    margin-bottom: 24px;
    transition: color 0.2s;
}

.back-link:hover {
    color: rgba(255, 255, 255, 0.9);
}

/* ============================================================================
   Form Elements
   ========================================================================== */

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.6);
}

.app-input,
.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(61, 61, 61, 0.6);
    border: 1px solid rgba(64, 64, 64, 0.8);
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    transition: all 0.2s;
}

.app-input:focus,
.form-group input:focus {
    outline: none;
    border-color: #4a90d9;
    background: rgba(61, 61, 61, 0.9);
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.1);
}

.password-hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 4px;
}

.error-message {
    background: rgba(217, 74, 74, 0.1);
    border: 1px solid #d94a4a;
    color: #d94a4a;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 20px;
    display: none;
}

.error-message.show {
    display: block;
}

/* ============================================================================
   Buttons
   ========================================================================== */

.app-btn-primary,
.submit-btn {
    background: linear-gradient(135deg, #4a90d9 0%, #3d7ec4 100%);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.app-btn-primary:hover:not(:disabled),
.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(74, 144, 217, 0.4);
}

.app-btn-primary:disabled,
.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.submit-btn {
    width: 100%;
    padding: 14px;
}

/* ============================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .app-hero h1,
    .app-hero h2 {
        font-size: 32px;
    }

    .app-hero {
        padding: 40px 20px 32px;
    }

    .document-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 16px;
        padding: 16px;
    }

    .auth-card {
        padding: 32px 24px;
        margin: 16px;
    }

    .auth-header h1 {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .app-hero h1,
    .app-hero h2 {
        font-size: 28px;
    }

    .document-grid {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 24px 20px;
    }
}
