/* 
   Share Generator Styles
   ZefreNET AI Internet Technologies
*/

/* Modal Overlay */
.share-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.share-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.share-modal {
    width: 95%;
    max-width: 1100px;
    height: 90vh;
    background: var(--navy-medium);
    border: 1px solid var(--gold-dark);
    border-radius: 20px;
    display: flex;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    position: relative;
}

/* Close Button */
.share-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--white);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s;
}

.share-close-btn:hover {
    background: var(--alert-red);
    border-color: var(--alert-red);
    transform: rotate(90deg);
}

/* Layout: Left (Preview), Right (Controls) */
.share-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

.share-preview-area {
    flex: 2;
    background: #0f1115;
    background-image: radial-gradient(#1a1f2e 10%, transparent 11%);
    background-size: 20px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    overflow: hidden;
    position: relative;
}

.share-controls-area {
    flex: 1;
    background: var(--navy-deep);
    border-left: 1px solid var(--glass-border);
    padding: 30px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-width: 320px;
}

/* The Canvas/Card Container */
.share-card-wrapper {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transition: all 0.5s ease;
    transform-origin: center center;
}

.share-card {
    width: 1080px;
    /* Base width for calculation, scaled down by CSS */
    /* Height will be set by JS based on ratio */
    background: #121724;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 80px;
    overflow: hidden;
}

/* Scaling for preview */


/* Content Elements */
.sc-content {
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.sc-header {
    margin-bottom: 20px;
    width: 100%;
    position: relative;
    z-index: 10;
}

.sc-logo {
    font-family: var(--font-heading);
    color: var(--gold-primary);
    font-size: 2.5rem;
    /* Reduced from 3rem */
    display: flex;
    flex-direction: column;
    /* Stack constraints */
    align-items: center;
    justify-content: center;
    gap: 15px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    width: 100%;
    text-align: center;
    line-height: 1.2;
}

.sc-logo i {
    font-size: 2rem;
    margin-bottom: 5px;
}

.sc-separator {
    /* Decorative line */
    width: 150px;
    height: 2px;
    background: var(--gold-primary);
    margin: 40px auto;
    /* Increased margin */
    position: relative;
    flex-shrink: 0;
}

.sc-separator::before,
.sc-separator::after {
    content: '♦';
    position: absolute;
    top: 50%;
    transform: translateY(-54%);
    /* Better centering */
    color: var(--gold-primary);
    font-size: 18px;
    background: #121724;
    /* Mask line behind diamond */
    padding: 0 5px;
}

.sc-separator::before {
    left: 40px;
}

.sc-separator::after {
    right: 40px;
}

.sc-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center vertical */
    align-items: center;
    gap: 30px;
    /* Reduced gap to prevent overflow */
    width: 85%;
    position: relative;
    z-index: 5;
}

.sc-source {
    font-family: var(--font-body);
    font-size: 1.8rem;
    /* Reduced from 2.2rem */
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.4;
    font-weight: 500;
    max-width: 100%;
    word-wrap: break-word;
}

.sc-target {
    font-family: var(--font-ottoman);
    font-size: 3rem;
    /* Reduced from 3.5rem */
    color: var(--gold-light);
    line-height: 1.6;
    direction: rtl;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    max-width: 100%;
    word-wrap: break-word;
}

.sc-footer {
    margin-top: 40px;
    font-family: var(--font-body);
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 3px;
    text-transform: uppercase;
    position: relative;
    z-index: 10;
}

/* Themes */

/* 1. Midnight Gold (Default) */
.theme-midnight {
    background: radial-gradient(circle at center, #1a2236 0%, #0d111b 100%);
}

.theme-midnight .sc-border {
    position: absolute;
    top: 30px;
    left: 30px;
    right: 30px;
    bottom: 30px;
    border: 2px solid rgba(201, 162, 39, 0.3);
    pointer-events: none;
}

.theme-midnight .sc-border::after {
    content: '';
    position: absolute;
    top: -5px;
    bottom: -5px;
    left: -5px;
    right: -5px;
    border: 1px solid rgba(201, 162, 39, 0.5);
}

/* 2. Ferman (Parchment) */
.theme-ferman {
    background: #fdfbf7;
    background-image:
        linear-gradient(rgba(240, 230, 210, 0.8), rgba(240, 230, 210, 0.8)),
        url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.6' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.15'/%3E%3C/svg%3E");
    color: #3e2723;
}

.theme-ferman .sc-logo,
.theme-ferman .sc-target {
    color: #5d4037 !important;
    text-shadow: none;
}

.theme-ferman .sc-source {
    color: #3e2723 !important;
}

.theme-ferman .sc-separator {
    background: #8d6e63;
}

.theme-ferman .sc-separator::before,
.theme-ferman .sc-separator::after {
    color: #8d6e63;
}

.theme-ferman .sc-footer {
    color: #8d6e63;
}

.theme-ferman .sc-border {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    border: 3px double #8d6e63;
}

/* 3. Ottoman Red (Velvet) */
.theme-red {
    background: radial-gradient(circle at center, #7f1d1d 0%, #450a0a 100%);
}

.theme-red .sc-target,
.theme-red .sc-logo {
    color: #fbbf24;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.theme-red .sc-border {
    position: absolute;
    top: 25px;
    left: 25px;
    right: 25px;
    bottom: 25px;
    border: 2px solid #fbbf24;
    border-radius: 4px;
}

.theme-red .sc-corner-decor {
    position: absolute;
    width: 100px;
    height: 100px;
    border-top: 5px solid #fbbf24;
    border-left: 5px solid #fbbf24;
    top: 25px;
    left: 25px;
}

.theme-red .sc-corner-decor.tr {
    transform: rotate(90deg);
    left: auto;
    right: 25px;
}

.theme-red .sc-corner-decor.br {
    transform: rotate(180deg);
    top: auto;
    bottom: 25px;
    left: auto;
    right: 25px;
}

.theme-red .sc-corner-decor.bl {
    transform: rotate(270deg);
    top: auto;
    bottom: 25px;
}

/* 4. Minimal Black */
.theme-minimal {
    background: #000000;
}

.theme-minimal .sc-source {
    font-weight: 300;
    letter-spacing: 1px;
}

.theme-minimal .sc-target {
    font-weight: 400;
}

.theme-minimal .sc-border {
    display: none;
}

/* Control Panel Widgets */
.cp-group {
    margin-bottom: 30px;
}

.cp-title {
    font-size: 0.9rem;
    color: var(--gray-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cp-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.cp-btn {
    background: var(--navy-light);
    border: 1px solid var(--glass-border);
    color: var(--white);
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.cp-btn:hover,
.cp-btn.active {
    background: var(--gold-primary);
    color: var(--navy-deep);
    border-color: var(--gold-primary);
}

.cp-btn i {
    font-size: 1.2rem;
}

.theme-preview-btn {
    height: 60px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.theme-preview-btn.active {
    border-color: var(--gold-primary);
    transform: scale(0.95);
}

/* Action Buttons */
.share-actions {
    margin-top: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.action-btn {
    padding: 15px;
    border-radius: 12px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
}

.btn-download {
    background: var(--navy-light);
    color: var(--white);
    border: 1px solid var(--glass-border);
}

.btn-download:hover {
    background: var(--white);
    color: var(--navy-deep);
}

.btn-share {
    background: var(--gold-primary);
    color: var(--navy-deep);
}

.btn-share:hover {
    background: var(--gold-light);
    transform: translateY(-2px);
}

/* AI Badge */
.ai-badge {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .share-modal {
        flex-direction: column;
        width: 100%;
        height: 100dvh;
        /* Better mobile viewport support */
        border-radius: 0;
        max-height: 100dvh;
    }

    .share-preview-area {
        flex: 1;
        padding: 20px;
        min-height: 50vh;
        /* Allow it to shrink if needed, but aim for 50% */
        display: flex;
        align-items: center;
        justify-content: center;
    }



    .share-controls-area {
        flex: 1;
        /* max-height removed to allow content to determine height within flex container, or use flex-grow */
        height: auto;
        min-height: 40vh;
        /* Ensure it takes at least some space */
        min-width: 0;
        border-left: none;
        border-top: 1px solid var(--glass-border);
        padding: 15px;
        overflow-y: auto;
        padding-bottom: 40px;
        /* Extra padding for bottom safe area */
    }

    .sc-logo {
        font-size: 2.5rem;
    }

    .sc-source {
        font-size: 1.8rem;
    }

    .sc-target {
        font-size: 3rem;
    }
}