/* Shared Styles for Imagly Pages */

/* Variables */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --accent-gradient: linear-gradient(135deg, #4ecdc4, #44a08d);
    --text-gradient: linear-gradient(135deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #ffeaa7);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --hover-glow: rgba(78, 205, 196, 0.4);
}

/* Body Layout */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0a0a0a;
    color: white;
    overflow-x: hidden;
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

/* Animated Background */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3), transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3), transparent 50%),
                radial-gradient(circle at 40% 80%, rgba(120, 219, 255, 0.3), transparent 50%);
    animation: backgroundFlow 20s ease-in-out infinite;
}

@keyframes backgroundFlow {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(2deg); }
}

/* Main Content Layout */
.main-content {
    padding: 120px 20px 80px 20px;
    flex: 1;
    margin-left: 0;
    max-width: calc(100% - 300px);
    margin: 0 auto;
    transition: margin-left 0.3s ease;
}

@media (min-width: 1025px) {
    .main-content {
        margin-left: 280px;
        max-width: calc(100vw - 280px - 40px);
    }
}

@media (max-width: 1024px) {
    .main-content {
        padding-left: 20px;
        max-width: 100%;
    }
}

/* Form Styles */
.generate-form {
    background: var(--glass-bg);
    border-radius: 20px;
    padding: 40px;
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    margin-bottom: 40px;
    transition: all 0.3s ease;
}

.generate-form:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: white;
}

.form-row {
    display: flex;
    gap: 15px;
    align-items: stretch;
    margin-bottom: 20px;
}

.form-row textarea {
    flex: 1;
    height: auto;
    resize: none;
    border-radius: 15px;
    font-size: 16px;
    line-height: 1.5;
    padding: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: white;
    transition: all 0.3s ease;
    min-height: 80px;
}

.form-row textarea:focus {
    border-color: #4ecdc4;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.2);
}

.form-row textarea::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.form-row .generate-btn {
    width: auto;
    padding: 16px 32px;
    font-size: 1rem;
    align-self: center;
    height: fit-content;
}

.form-group input[type="number"] {
    width: 100px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    text-align: center;
}

.form-group input[type="number"]:focus {
    outline: none;
    border-color: #4ecdc4;
}

.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4ecdc4;
}

/* Mode Blocks */
.mode-blocks {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.mode-block {
    width: 100px;
    height: 60px;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    padding: 8px;
}

.mode-label {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-bottom: 2px;
}

.mode-value {
    font-size: 0.9rem;
    font-weight: 700;
    display: none;
}

.mode-block.selected .mode-label {
    display: none;
}

.mode-block.selected .mode-value {
    display: block;
}

.mode-block.selected {
    background: rgba(78, 205, 196, 0.1);
    border-color: #4ecdc4;
}

.mode-block:hover {
    background: rgba(78, 205, 196, 0.1);
    border-color: #4ecdc4;
    transform: scale(1.05);
}

/* Generate Button */
.generate-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    background: var(--primary-gradient);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: none;
    cursor: pointer;
    width: 100%;
    justify-content: center;
}

.generate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Results */
.result-container {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.image-card {
    background: var(--glass-bg);
    border-radius: 15px;
    padding: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    text-align: center;
    transition: all 0.3s ease;
    width: 100%;
}

.image-card.landscape {
    max-width: 768px;
}

.image-card.portrait {
    max-width: 512px;
}

.image-card.square {
    max-width: 512px;
}

.image-card.auto {
    max-width: 512px;
}

.image-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.image-card img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: pointer;
}

.image-card.landscape img {
    aspect-ratio: 3 / 2;
    max-width: 768px;
    max-height: 512px;
}

.image-card.portrait img {
    aspect-ratio: 2 / 3;
    max-width: 512px;
    max-height: 768px;
}

.image-card.square img {
    aspect-ratio: 1 / 1;
    max-width: 512px;
    max-height: 512px;
}

.image-card.auto img {
    max-width: 512px;
    max-height: 512px;
}

.download-image-btn {
    padding: 8px 16px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.download-image-btn:hover {
    transform: scale(1.05);
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

@media (min-width: 1025px) {
    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

/* Loading */
.loading {
    display: none;
    text-align: center;
    margin: 20px 0;
}

.spinner {
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid #4ecdc4;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--glass-bg);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal-content h3 {
    color: #4ecdc4;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.modal-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-option {
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.modal-option:hover {
    background: rgba(78, 205, 196, 0.1);
    border-color: #4ecdc4;
}

/* Custom Toggles */
.custom-toggle {
    margin-bottom: 15px;
}

.custom-toggle input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toggle-slider:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(78, 205, 196, 0.3);
}

.toggle-text {
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
    flex: 1;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 13px;
    transition: all 0.3s ease;
}

.toggle-switch::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input[type="checkbox"]:checked + .toggle-slider .toggle-switch {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
}

input[type="checkbox"]:checked + .toggle-slider .toggle-switch::before {
    transform: translateX(24px);
    background: white;
}

input[type="checkbox"]:checked + .toggle-slider {
    background: rgba(78, 205, 196, 0.1);
    border-color: #4ecdc4;
}

/* Full Screen Image Viewer */
.image-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
}

.image-viewer.active {
    display: flex;
}

.viewer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.viewer-content {
    position: relative;
    z-index: 3001;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.viewer-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.viewer-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.viewer-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.viewer-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(78, 205, 196, 0.5);
    transform: translateY(-2px);
}

.viewer-close {
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.3);
}

.viewer-close:hover {
    background: rgba(255, 107, 107, 0.2);
    border-color: rgba(255, 107, 107, 0.5);
}

.btn-icon {
    font-size: 1rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .hamburger {
        display: flex;
    }

    .header .nav-links {
        display: none;
    }

    .side-menu {
        left: -280px;
    }

    .main-content {
        padding-left: 20px;
        margin-left: 0;
        max-width: 100%;
    }

    .generate-form {
        padding: 25px;
    }

    .side-menu.active {
        left: 0;
    }

    .form-row {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (min-width: 1025px) {
    .hamburger {
        display: none;
    }

    .header .nav-links {
        display: flex;
    }

    .side-menu {
        left: 0;
    }
}

@media (max-width: 768px) {
    .image-card img {
        height: 300px;
    }

    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .mode-blocks {
        flex-wrap: wrap;
    }

    .mode-block {
        width: 80px;
        height: 50px;
    }
}
