/* Design Tokens & Variables */
:root {
    --bg-main: #090d16;
    --bg-card: rgba(17, 25, 40, 0.7);
    --bg-card-hover: rgba(22, 33, 54, 0.85);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-hover: rgba(212, 175, 55, 0.3);
    
    --color-primary: #d4af37; /* Metallic Gold */
    --color-primary-light: #f3d082;
    --color-text-main: #f1f5f9; /* Slate 100 */
    --color-text-muted: #94a3b8; /* Slate 400 */
    --color-text-dark: #64748b; /* Slate 500 */
    --color-error: #ef4444;
    --color-success: #10b981;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --shadow-lg: 0 12px 48px 0 rgba(0, 0, 0, 0.5);
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    
    --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
    --font-poem: 'EB Garamond', Georgia, serif;
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--color-text-main);
    font-family: var(--font-ui);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Background ambient glows */
.bg-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(150px);
    opacity: 0.12;
    z-index: -1;
    pointer-events: none;
}

.bg-glow-1 {
    background: radial-gradient(circle, var(--color-primary) 0%, transparent 70%);
    top: -200px;
    right: -100px;
}

.bg-glow-2 {
    background: radial-gradient(circle, #3b82f6 0%, transparent 70%);
    bottom: -100px;
    left: -200px;
}

a {
    color: inherit;
    text-decoration: none;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Glassmorphism utility card */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    transition: border-color var(--transition-normal), transform var(--transition-normal), box-shadow var(--transition-normal), background var(--transition-normal);
}

/* App Header & Navigation */
.app-header {
    background: rgba(9, 13, 22, 0.7);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.logo-icon {
    font-size: 24px;
    color: var(--color-primary);
    transform: rotate(-15deg);
    transition: transform var(--transition-normal);
}

.logo:hover .logo-icon {
    transform: rotate(5deg) scale(1.1);
}

.logo-text {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.logo-text span {
    color: var(--color-primary);
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.nav-link i {
    font-size: 14px;
}

.nav-link:hover {
    color: var(--color-text-main);
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: var(--color-primary);
    background: rgba(212, 175, 55, 0.08);
    border: 1px solid rgba(212, 175, 55, 0.25);
}

/* Main Layout */
.main-content {
    flex: 1;
    padding-top: 40px;
    padding-bottom: 60px;
}

.view-section {
    display: none;
    animation: fadeIn var(--transition-normal);
}

.view-section.active {
    display: block;
}

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

/* Typography styles */
h1 {
    font-size: 38px;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 50%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
}

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

.section-header p {
    color: var(--color-text-muted);
    font-size: 16px;
}

/* Hero elements */
.hero-text {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 40px auto;
}

.hero-text p {
    font-size: 18px;
    color: var(--color-text-muted);
}

/* Featured Poem Card styling (Homepage) */
.poem-card-container {
    max-width: 650px;
    margin: 0 auto;
}

.poem-featured-card {
    padding: 40px;
    position: relative;
    overflow: hidden;
}

.card-decor {
    position: absolute;
    top: 24px;
    left: 24px;
    opacity: 0.05;
    pointer-events: none;
}

.quote-icon {
    font-size: 60px;
    color: var(--color-text-main);
}

.poem-display-area {
    text-align: center;
}

.poem-title {
    font-family: var(--font-poem);
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--color-text-main);
    margin-bottom: 6px;
}

.poem-author {
    font-family: var(--font-ui);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--color-primary);
    margin-bottom: 24px;
}

.poem-divider {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--glass-border), var(--color-primary), var(--glass-border), transparent);
    margin: 0 auto 30px auto;
    width: 60%;
    opacity: 0.6;
}

.poem-text {
    font-family: var(--font-poem);
    font-size: 20px;
    line-height: 1.8;
    color: #e2e8f0;
    white-space: pre-wrap;
    text-align: center;
    font-style: italic;
    margin-bottom: 20px;
    max-height: 500px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

/* Customize scrollbar in poem-text */
.poem-text::-webkit-scrollbar {
    width: 6px;
}

.poem-text::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.card-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 32px;
    border-top: 1px solid var(--glass-border);
    padding-top: 24px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, #b89327 100%);
    border: none;
    color: #000;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.35);
    background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary) 100%);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    color: var(--color-text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

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

.btn-outline:hover {
    background: rgba(212, 175, 55, 0.08);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.15);
}

.btn-danger {
    background: transparent;
    border: 1px solid var(--color-error);
    color: var(--color-error);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.12);
}

.btn-block {
    display: flex;
    width: 100%;
}

/* Search Bar (Browse page) */
.search-bar-container {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    max-width: 700px;
    margin: 0 auto 40px auto;
}

.search-icon {
    font-size: 18px;
    color: var(--color-text-muted);
    margin-right: 12px;
}

#search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--color-text-main);
    font-size: 16px;
    padding: 10px 0;
}

#search-input::placeholder {
    color: var(--color-text-dark);
}

/* Poems Grid (Browse page) */
.poems-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.poem-item-card {
    padding: 24px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 300px;
}

.poem-item-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--glass-border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.poem-item-card .poem-title {
    font-size: 22px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

.poem-item-card .poem-author {
    font-size: 11px;
    margin-bottom: 16px;
    text-align: left;
}

.poem-item-card .poem-snippet {
    font-family: var(--font-poem);
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text-muted);
    overflow: hidden;
    position: relative;
    flex: 1;
    white-space: pre-line;
    /* Soft bottom fade-out */
    mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}

.poem-item-card .poem-date {
    font-size: 11px;
    color: var(--color-text-dark);
    margin-top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Form Upload styling */
.upload-container {
    max-width: 600px;
    margin: 0 auto;
}

.upload-form {
    padding: 32px;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--color-text-muted);
}

.form-group label .required {
    color: var(--color-error);
}

.form-group input,
.form-group textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-main);
    padding: 12px 16px;
    font-family: var(--font-ui);
    font-size: 15px;
    outline: none;
    transition: all var(--transition-fast);
}

.form-group textarea {
    font-family: var(--font-poem);
    font-size: 18px;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.15);
    background: rgba(0, 0, 0, 0.35);
}

.form-help {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--color-text-dark);
    margin-top: 6px;
}

/* Captcha styling */
.captcha-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--glass-border);
}

.captcha-wrapper span {
    font-size: 16px;
    font-weight: 500;
    color: var(--color-primary-light);
    flex: 1;
    letter-spacing: 0.5px;
}

.btn-icon {
    padding: 8px 12px;
}


/* Modal detail card */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(4, 7, 13, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn var(--transition-fast);
}

.modal-content {
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    padding: 40px;
    position: relative;
    display: flex;
    flex-direction: column;
    animation: scaleUp var(--transition-normal);
}

@keyframes scaleUp {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    font-size: 24px;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--color-text-main);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 24px;
    padding-right: 10px;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--glass-border);
    padding-top: 20px;
}

.modal-overlay.hidden,
.empty-state.hidden,
.loader-container.hidden,
.toast.hidden {
    display: none !important;
}

/* Loader / Spinners */
.loader-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
    width: 100%;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(212, 175, 55, 0.15);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 48px;
    color: var(--color-text-dark);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--color-text-muted);
    max-width: 400px;
    margin: 0 auto;
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(17, 25, 40, 0.95);
    border: 1px solid var(--color-success);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1001;
    animation: slideUp var(--transition-fast);
}

.toast.toast-error {
    border-color: var(--color-error);
}

.toast.toast-error i {
    color: var(--color-error);
}

.toast i {
    color: var(--color-success);
    font-size: 18px;
}

@keyframes slideUp {
    from {
        bottom: 10px;
        opacity: 0;
    }
    to {
        bottom: 30px;
        opacity: 1;
    }
}

/* App Footer */
.app-footer {
    border-top: 1px solid var(--glass-border);
    padding: 24px 0;
    text-align: center;
    margin-top: auto;
    font-size: 13px;
    color: var(--color-text-dark);
}

.footer-link {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 13px;
    text-decoration: underline;
    padding: 0;
}

.footer-link:hover {
    color: var(--color-primary);
}

.moderator-status {
    margin-left: 8px;
    color: var(--color-success);
    font-size: 12px;
}

.moderator-status.active {
    font-weight: 500;
}

/* Responsive queries */
@media (max-width: 768px) {
    h1 {
        font-size: 28px;
    }
    
    .app-header .header-container {
        flex-direction: column;
        height: auto;
        padding: 16px;
        gap: 16px;
    }
    
    .nav-links {
        width: 100%;
        justify-content: center;
    }
    
    .poem-featured-card {
        padding: 24px;
    }
    
    .poem-title {
        font-size: 26px;
    }
    
    .poem-text {
        font-size: 17px;
    }
    
    .card-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}
