/* ============================================
   CSS Variables
   ============================================ */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a2332;
    --bg-hover: #243044;
    
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --accent-primary: #10b981;
    --accent-secondary: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-orange: #f59e0b;
    
    --border-color: #374151;
    --border-focus: #10b981;
    
    --gradient-1: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
    --gradient-2: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    
    --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    
    --font-family: 'Tajawal', sans-serif;
    --transition: all 0.3s ease;
}

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

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ============================================
   Background
   ============================================ */
.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(16, 185, 129, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* ============================================
   Container
   ============================================ */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   Header
   ============================================ */
.header {
    text-align: center;
    padding: 2rem 0 3rem;
    animation: fadeInDown 0.6s ease;
}

.logo {
    font-size: 3.5rem;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    letter-spacing: -2px;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 400;
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
    flex: 1;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

/* ============================================
   Choice Section
   ============================================ */
.choice-section {
    animation: fadeIn 0.5s ease;
}

.choice-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.choice-btn {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
}

.choice-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.choice-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.choice-text {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.choice-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* ============================================
   Form Section
   ============================================ */
.form-section {
    animation: fadeIn 0.5s ease;
}

.back-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    font-family: var(--font-family);
    cursor: pointer;
    margin-bottom: 1.5rem;
    padding: 0.5rem 0;
    transition: var(--transition);
}

.back-btn:hover {
    color: var(--accent-primary);
}

#poemForm {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.required {
    color: #ef4444;
}

.optional {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.85rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    font-family: var(--font-family);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    transition: var(--transition);
}

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

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-group select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.submit-btn {
    width: 100%;
    padding: 1.25rem;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-family);
    background: var(--gradient-1);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}

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

.btn-loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   Result Section
   ============================================ */
.result-section {
    animation: fadeIn 0.5s ease;
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
}

.result-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
}

.result-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
}

.meta-label {
    color: var(--text-muted);
}

.meta-value {
    color: var(--accent-primary);
    font-weight: 600;
}

.verses-container {
    padding: 2rem;
}

.verse {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 1.15rem;
    line-height: 1.8;
    text-align: right;
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

.verse:last-child {
    border-bottom: none;
}

.verse-line {
    display: block;
    margin-bottom: 0.5rem;
}

.verse-line.first {
    font-weight: 500;
    text-align: right;
}

.verse-line.second {
    text-align: left;
    color: var(--text-primary);
}

/* ============================================
   Share Buttons
   ============================================ */
.share-buttons {
    display: flex;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    justify-content: center;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-family: var(--font-family);
    font-weight: 500;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.share-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

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

.share-btn.success {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.share-icon {
    font-size: 1.1rem;
}

.copy-btn:hover {
    border-color: var(--accent-secondary);
}

.copy-btn.success {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--accent-secondary);
    color: var(--accent-secondary);
}

.image-btn:hover {
    border-color: var(--accent-purple);
}

.image-btn.success {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--accent-purple);
    color: var(--accent-purple);
}

@media (max-width: 640px) {
    .share-buttons {
        flex-direction: column;
        padding: 1rem 1.5rem;
    }
    
    .share-btn {
        justify-content: center;
    }
}

/* ============================================
   Utility Classes
   ============================================ */
.hidden {
    display: none !important;
}

/* ============================================
   Footer
   ============================================ */
.footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

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

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }
    
    .logo {
        font-size: 2.5rem;
    }
    
    .tagline {
        font-size: 1rem;
    }
    
    .choice-buttons {
        grid-template-columns: 1fr;
    }
    
    .choice-btn {
        padding: 1.5rem;
    }
    
    #poemForm {
        padding: 1.5rem;
    }
    
    .result-header {
        padding: 1.25rem 1.5rem;
    }
    
    .verses-container {
        padding: 1.5rem;
    }
    
    .verse {
        font-size: 1rem;
    }
}

