/* Theme Preview Styles */

/* Floating Preview */
.floating-preview {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.floating-preview.minimized {
    height: 50px;
    overflow: hidden;
}

.preview-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 12px 12px 0 0;
}

.preview-title {
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.preview-toggle,
.preview-close {
    background: none;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background-color 0.2s;
}

.preview-toggle:hover,
.preview-close:hover {
    background: #e5e7eb;
}

.preview-toggle {
    margin-right: 8px;
}

.preview-phone {
    flex: 1;
    padding: 0; /* Remove padding so preview-content fills the space */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    border-radius: 0 0 12px 12px;
    overflow: visible;
    position: relative;
}

/* Theme Preview */
.theme-preview {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
}

.preview-phone {
    width: 100%;
    /* height is controlled by JavaScript for proper scaling */
    border: 8px solid #1f2937;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.preview-content {
    position: relative;
    z-index: 1;
    border-radius: 20px;
    overflow: visible; /* Changed from hidden to visible */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    /* Size and transform are now controlled by JavaScript - remove CSS overrides */
    /* min-width and min-height to ensure it doesn't shrink below needed size */
    min-width: 1080px;
    min-height: 1920px;
}

.preview-avatar-container {
    position: absolute;
    top: 20%; /* 1/5 of the height */
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.preview-avatar {
    width: clamp(60px, 8vw, 120px); /* Consistent with original scaling but better minimum */
    height: clamp(60px, 8vw, 120px); /* Match width for perfect circle */
    border-radius: 50%;
    object-fit: cover;
    border: 0.25vw solid rgba(255, 255, 255, 0.3); /* Relative border */
    box-shadow: 0 0.4vw 1.2vw rgba(0, 0, 0, 0.2); /* Relative shadow */
    background-color: #f0f0f0;
}

.preview-bio-container {
    position: absolute;
    top: 35%; /* Position below the avatar at 1/5 (20%) + some spacing */
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 2;
    width: 80%; /* Constrain width for readability */
    max-width: 400px; /* Cap width for larger screens */
}

.preview-username {
    font-size: 18px; /* Will be dynamically calculated by JavaScript */
    color: #666666; /* Fallback color, will be overridden by JavaScript */
    font-weight: 550; /* Will be overridden by JavaScript with theme font weight + 90 */
    margin-bottom: 0.25rem; /* Reduced spacing */
    line-height: 1.2;
    white-space: nowrap; /* Prevent wrapping to ensure it fits on one line */
    width: 100%; /* Use full container width */
}

.preview-description {
    font-size: clamp(11px, 1.1vw, 15.4px); /* Dynamic: min 11px, preferred 1.1vw, max 15.4px - 10% larger */
    color: #666666; /* Fallback color, will be overridden by JavaScript */
    line-height: 1.2; /* Good balance - not too tight, not too loose */
    font-weight: 400;
}

.preview-links-container {
    position: absolute;
    top: 0; /* Will be set by JavaScript */
    left: 0;
    width: 100%; /* Full width of preview-content */
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center the buttons horizontally */
    gap: 0.75rem; /* Space between buttons */
}

.preview-link-button {
    width: 90%; /* 90% of container width */
    height: 0; /* Will be set by JavaScript as 9% of container height */
    aspect-ratio: auto; /* Let height control the sizing */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px; /* From theme model ButtonRadius */
    text-align: center;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: #000000; /* Fallback, will be overridden by JavaScript */
    color: #ffffff; /* Fallback, will be overridden by JavaScript */
    border: 1px solid transparent; /* Fallback, will be overridden by JavaScript */
    box-shadow: none; /* Fallback, will be overridden by JavaScript */
}

/* Theme Preview Section */
.theme-preview-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.theme-preview-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

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

/* Legacy preview styles (for compatibility) */
.preview-header {
    text-align: center;
    margin-bottom: 2rem;
}

.preview-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: #d1d5db;
    margin: 0 auto 1rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-username {
    font-weight: 600;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.preview-bio {
    font-size: 0.875rem;
    opacity: 0.8;
}

.preview-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 200px;
    overflow-y: auto;
}

.preview-link {
    padding: 1rem;
    text-align: center;
    border-radius: 8px;
    font-weight: 500;
}

/* Responsive Floating Preview */
@media (max-width: 1200px) {
    .floating-preview {
        bottom: 15px;
        right: 15px;
    }
}

@media (max-width: 768px) {
    .floating-preview {
        bottom: 5px;
        right: 5px;
    }

    .preview-phone {
        padding: 10px;
    }

    .preview-header {
        padding: 8px 10px;
    }

    /* Removed avatar fixed size override to allow smooth clamp() scaling */

    .preview-link {
        padding: 8px 10px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .floating-preview {
        bottom: 5px;
        right: 5px;
    }

    .preview-phone {
        padding: 5px;
    }

    .preview-header {
        padding: 6px 8px;
    }

    .preview-avatar {
        width: 60px;
        height: 60px;
    }

    .preview-link {
        padding: 6px 8px;
        font-size: 11px;
    }
}