/* RISE Certificate Generator - Enhanced UI/UX */
:root {
    --primary-yellow: #FFD700;
    --secondary-gold: #FFA500;
    --accent-orange: #FF8C00;
    --dark-gold: #B8860B;
    --text-dark: #1a1a1a;
    --text-light: #4a4a4a;
    --white: #ffffff;
    --light-yellow: #FFF8DC;
    --border-gold: #DAA520;
    --shadow-gold: rgba(255, 215, 0, 0.3);
    --gradient-primary: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    --gradient-secondary: linear-gradient(135deg, #FFA500 0%, #FF8C00 100%);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gradient-primary);
    min-height: 100vh;
    color: var(--text-dark);
    line-height: 1.6;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 215, 0, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 165, 0, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Hero Header */
.hero-header {
    background: var(--gradient-secondary);
    padding: 2rem 2rem 3rem;
    text-align: center;
    color: var(--white);
    position: relative;
    overflow: hidden;
}

.hero-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 30% 70%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 70% 30%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.header-content {
    position: relative;
    z-index: 1;
}

.logo-section {
    margin-bottom: 1.5rem;
}

.rise-logo {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 1rem 2rem;
    border-radius: 50px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.sun-icon {
    font-size: 2.5rem;
    animation: pulse 2s ease-in-out infinite;
}

.rise-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.rise-main {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 2px;
}

.rise-sub {
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.9;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.title-section h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.subtitle {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    opacity: 0.95;
}

.description {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 400;
}

/* Main Content */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem;
    align-items: start;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1rem;
    }
}

/* Section Headers */
.section-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.section-header p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* Form Section */
.form-section {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    border: 2px solid var(--border-gold);
    position: relative;
    overflow: hidden;
}

.form-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.input-group {
    margin-bottom: 1.2rem;
}

.input-group:last-of-type {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
}

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

.input-group input {
    width: 100%;
    padding: 1.2rem 1.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--white);
    font-family: inherit;
    box-sizing: border-box;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-yellow);
    box-shadow: 0 0 0 4px var(--shadow-gold);
    transform: translateY(-2px);
}

.input-group input::placeholder {
    color: #9ca3af;
}

/* Button Styles */
.primary-btn {
    background: var(--gradient-primary);
    color: var(--text-dark);
    border: none;
    padding: 1.2rem 2rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.primary-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.primary-btn:hover::before {
    left: 100%;
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px var(--shadow-gold);
}

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

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

.primary-btn {
    margin-bottom: 1rem;
}

.btn-icon {
    font-size: 1.2rem;
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(26, 26, 26, 0.3);
    border-top: 2px solid var(--text-dark);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Preview Section */
.preview-section {
    background: var(--white);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    border: 2px solid var(--border-gold);
    position: relative;
    overflow: hidden;
}

.preview-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.certificate-preview {
    margin-bottom: 2rem;
}

.preview-container {
    position: relative;
    border: 3px solid var(--border-gold);
    border-radius: 15px;
    overflow: hidden;
    background: var(--light-yellow);
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

/* PDF generation specific styles - these will be applied during PDF generation */
.preview-container.pdf-generation {
    border: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
    background: #ffffff !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    min-height: auto !important;
    display: block !important;
    position: relative !important;
}

.preview-container.pdf-generation #certificateTemplate {
    border-radius: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Ensure no gaps in PDF generation */
.preview-container.pdf-generation * {
    margin: 0 !important;
    padding: 0 !important;
}

/* Maintain correct positioning for text overlays during PDF generation */
.preview-container.pdf-generation {
    position: relative !important;
}

.preview-container.pdf-generation .name-overlay {
    position: absolute !important;
    top: 48.4% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 10 !important;
    opacity: 1 !important;
    transition: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.preview-container.pdf-generation .club-overlay {
    position: absolute !important;
    top: 55.5% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 10 !important;
    opacity: 1 !important;
    transition: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

#certificateTemplate {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 0;
}

.name-overlay {
    position: absolute;
    top: 48.4%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 400;
    text-align: center;
    pointer-events: none;
    z-index: 10;
    max-width: 95%;
    word-wrap: normal;
    white-space: nowrap;
    overflow: visible;
    line-height: 1.2;
    font-family: 'Fira Sans', sans-serif;
    color: #000000;
}

.club-overlay {
    position: absolute;
    top: 55.5%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 400;
    text-align: center;
    pointer-events: none;
    z-index: 10;
    max-width: 95%;
    word-wrap: normal;
    white-space: nowrap;
    overflow: visible;
    line-height: 1.2;
    font-family: 'Fira Sans', sans-serif;
    color: #000000;
}

/* Download Section */
.download-section {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 2px solid #f3f4f6;
}

.download-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    transition: all 0.5s ease;
}

.success-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #059669;
    font-weight: 600;
    font-size: 1rem;
}

.success-icon {
    font-size: 1.2rem;
}

.download-btn {
    background: var(--gradient-secondary);
    color: var(--white);
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 300px;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 165, 0, 0.3);
}

/* Footer */
.app-footer {
    background: var(--gradient-secondary);
    color: var(--white);
    padding: 1.5rem 2rem;
    text-align: center;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-info p {
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.footer-info p:last-child {
    margin-bottom: 0;
    opacity: 0.9;
    font-size: 0.9rem;
}

/* Help Text */
.help-text {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    text-align: center;
}

.required {
    color: #dc2626;
    font-weight: 700;
}

/* Error Message */
.error-message {
    background: #fef2f2;
    border: 2px solid #fecaca;
    color: #dc2626;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin: 1rem 0 0 0;
    text-align: center;
    font-weight: 600;
    box-shadow: 0 5px 15px rgba(220, 38, 38, 0.1);
    animation: slideIn 0.3s ease;
    font-size: 0.9rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.loading-content {
    background: var(--white);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--border-gold);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid var(--primary-yellow);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.loading-content p {
    color: var(--text-dark);
    font-weight: 600;
    margin: 0;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Input validation styles */
.input-group input.invalid {
    border-color: #dc2626;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.1);
}

.input-group input.invalid:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.2);
}

/* Focus styles for accessibility */
input:focus,
button:focus {
    outline: 2px solid var(--primary-yellow);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-yellow: #FFD700;
        --text-dark: #000000;
        --text-light: #333333;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .sun-icon {
        animation: none;
    }
}

/* Certificate Template Placeholder */
.preview-container::before {
    content: "Certificate Template Preview";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #9ca3af;
    font-size: 1.1rem;
    text-align: center;
    z-index: 1;
    display: none;
}

.preview-container.no-template::before {
    display: block;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .hero-header {
        padding: 1.5rem 1rem 2rem;
    }
    
    .title-section h1 {
        font-size: 2.5rem;
    }
    
    .main-content {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .hero-header {
        padding: 1rem 0.5rem 1.5rem;
    }
    
    .title-section h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1.1rem;
    }
    
    .rise-logo {
        padding: 0.8rem 1.5rem;
    }
    
    .rise-main {
        font-size: 1.5rem;
    }
    
    .form-section,
    .preview-section {
        padding: 1rem;
        margin: 0 0.25rem;
    }
    
    .main-content {
        padding: 1rem 0.25rem;
    }
    
    .input-group input {
        padding: 1rem 1.2rem;
    }
}
