/* =============================================================================
   Quote Image Share - Styles for generating shareable quote images
   ============================================================================= */

/* Share Button Styling - Uses existing .btn-icon style from suhasiya.html */
/* No custom styling needed - button inherits from .btn-inline.btn-icon */

/* Template Selection Modal */
.template-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: var(--space-lg);
    animation: fadeIn 0.3s ease;
}

.template-modal.active {
    display: flex;
}

.template-modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

.template-modal h2 {
    font-family: 'Adishila', var(--font-display);
    color: var(--primary-dark);
    margin-bottom: var(--space-lg);
    font-size: 1.8rem;
}

.template-modal-close {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
    background: transparent;
    border: none;
    font-size: 2rem;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-modal-close:hover {
    color: var(--primary);
    transform: rotate(90deg);
}

/* Template Grid */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.template-option {
    border: 3px solid transparent;
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.template-option:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.template-option.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.2);
}

.template-preview {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--space-md);
    text-align: center;
    position: relative;
}

.template-preview::before {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--white);
    color: var(--primary);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.template-option.selected .template-preview::before {
    opacity: 1;
}

.template-preview-text {
    font-family: 'Adishila', serif;
    font-size: 1.2rem;
    color: #2F1810; /* Dark brown for light backgrounds */
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
    margin-bottom: var(--space-sm);
}

.template-preview-subtitle {
    font-size: 0.8rem;
    color: #3A3023; /* Medium brown */
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.2);
}

.template-name {
    text-align: center;
    margin-top: var(--space-sm);
    font-family: var(--font-display);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
}

/* Template Gradient Definitions - Matching Website Aesthetic */
.template-preview.manuscript {
    background: linear-gradient(135deg, #F5DEB3 0%, #D2B48C 100%);
}

.template-preview.parchment {
    background: linear-gradient(135deg, #F8F0E3 0%, #EDE0C8 100%);
}

.template-preview.sepia {
    background: linear-gradient(135deg, #EDE0C8 0%, #D2B48C 100%);
}

.template-preview.abstract-circles {
    background: #E8D7C3;
    position: relative;
}

.template-preview.abstract-circles::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(210, 180, 140, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(139, 69, 19, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(245, 222, 179, 0.25) 0%, transparent 60%);
    pointer-events: none;
}

.template-preview.abstract-waves {
    background: linear-gradient(135deg, #F0E6D8 0%, #D9C8B4 100%);
    position: relative;
}

.template-preview.abstract-waves::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 20px,
            rgba(139, 69, 19, 0.05) 20px,
            rgba(139, 69, 19, 0.05) 40px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 20px,
            rgba(210, 180, 140, 0.08) 20px,
            rgba(210, 180, 140, 0.08) 40px
        );
    pointer-events: none;
}

/* Generate Button */
.btn-generate-image {
    width: 100%;
    padding: var(--space-md) var(--space-xl);
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-family: var(--font-display);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-sm);
}

.btn-generate-image:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-generate-image:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Loading Spinner */
.loading-spinner {
    display: none;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner.active {
    display: inline-block;
}

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

/* Hidden Image Template Container */
.quote-image-container {
    position: fixed;
    top: -9999px;
    left: -9999px;
    width: 1080px;
    height: 1080px;
    z-index: -1;
}

/* Quote Image Template Styles */
.quote-image-template {
    width: 1080px;
    height: 1080px;
    padding: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Gradient Backgrounds - Matching Website Aesthetic */
.quote-image-template.manuscript {
    background: linear-gradient(135deg, #F5DEB3 0%, #D2B48C 100%);
}

.quote-image-template.parchment {
    background: linear-gradient(135deg, #F8F0E3 0%, #EDE0C8 100%);
}

.quote-image-template.sepia {
    background: linear-gradient(135deg, #EDE0C8 0%, #D2B48C 100%);
}

/* Abstract Background Templates */
.quote-image-template.abstract-circles {
    background: #E8D7C3;
}

.quote-image-template.abstract-circles::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 15% 25%, rgba(210, 180, 140, 0.35) 0%, transparent 45%),
        radial-gradient(circle at 85% 75%, rgba(139, 69, 19, 0.25) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(245, 222, 179, 0.3) 0%, transparent 55%),
        radial-gradient(circle at 70% 30%, rgba(210, 180, 140, 0.2) 0%, transparent 40%),
        radial-gradient(circle at 30% 80%, rgba(139, 69, 19, 0.15) 0%, transparent 45%);
    pointer-events: none;
    z-index: 1;
}

.quote-image-template.abstract-waves {
    background: linear-gradient(135deg, #F0E6D8 0%, #D9C8B4 100%);
}

.quote-image-template.abstract-waves::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 60px,
            rgba(139, 69, 19, 0.06) 60px,
            rgba(139, 69, 19, 0.06) 120px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 60px,
            rgba(210, 180, 140, 0.1) 60px,
            rgba(210, 180, 140, 0.1) 120px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 80px,
            rgba(245, 222, 179, 0.08) 80px,
            rgba(245, 222, 179, 0.08) 160px
        );
    pointer-events: none;
    z-index: 1;
}

/* Decorative Elements */
.quote-image-template::before {
    content: '';
    position: absolute;
    top: 40px;
    left: 40px;
    right: 40px;
    bottom: 40px;
    border: 3px solid rgba(47, 24, 16, 0.2); /* Dark brown border */
    border-radius: 20px;
    pointer-events: none;
}

/* Quote Content */
.quote-image-content {
    position: relative;
    z-index: 2;
    width: 100%;
}

.quote-image-prakrit {
    font-family: 'Cormorant Garamond', 'Adishila', serif;
    font-size: 52px;
    font-weight: 500; /* Medium */
    line-height: 1.5;
    color: #2F1810; /* Dark brown text */
    text-shadow: 0 2px 4px rgba(255, 255, 255, 0.3);
    margin-bottom: 60px;
    word-wrap: break-word;
    white-space: pre-wrap; /* Preserve line breaks and spaces */
}

.quote-image-translation {
    font-family: 'Cormorant Garamond', serif;
    font-size: 32px;
    line-height: 1.6;
    color: #3A3023; /* Medium brown text */
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.2);
    margin-bottom: 24px;
    font-style: italic;
    font-weight: 500; /* Medium */
    white-space: pre-wrap; /* Preserve line breaks and spaces */
}

.quote-image-hindi {
    font-family: 'Adishila', 'Noto Sans Devanagari', sans-serif;
    font-size: 32px;
    line-height: 1.6;
    color: #3A3023; /* Medium brown text */
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.2);
    margin-bottom: 60px;
    font-style: italic;
    font-weight: normal;
    white-space: pre-wrap; /* Preserve line breaks and spaces */
}

.quote-image-source {
    font-family: 'Cormorant Garamond', serif;
    font-size: 26px;
    font-style: normal;
    font-weight: 500; /* Medium */
    color: #654321; /* Primary dark brown */
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.2);
    margin-bottom: 40px;
}

.quote-image-watermark {
    font-family: 'Arial', sans-serif;
    font-size: 20px;
    color: rgba(47, 24, 16, 0.6); /* Semi-transparent dark brown */
    text-shadow: none;
    font-weight: 500;
    position: absolute;
    bottom: 60px; /* Position above border line */
    left: 0;
    right: 0;
    text-align: center;
}

.quote-image-logo {
    position: absolute;
    top: 50px;
    right: 50px;
    width: 140px;
    height: auto;
    opacity: 0.9;
    z-index: 3;
}

/* Responsive Design */
@media (max-width: 768px) {
    .template-modal-content {
        padding: var(--space-lg);
    }

    .template-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-md);
    }

    .template-modal h2 {
        font-size: 1.4rem;
    }

    .btn-share-image {
        font-size: 0.85rem;
        padding: 0.4rem 0.6rem;
    }
}

@media (max-width: 480px) {
    .template-grid {
        grid-template-columns: 1fr;
    }

    .template-modal-content {
        padding: var(--space-md);
    }

    .template-modal h2 {
        font-size: 1.2rem;
        margin-bottom: var(--space-md);
    }
}

/* Accessibility */
.template-option:focus {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.btn-share-image:focus,
.btn-generate-image:focus {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .template-modal,
    .template-option,
    .btn-share-image,
    .btn-generate-image,
    .loading-spinner {
        animation: none !important;
        transition: none !important;
    }
}
