* {
    box-sizing: border-box;
}

body.dark {
    margin: 0;
    font-family: Inter, Arial, sans-serif;
    background: radial-gradient(circle at top, #141825, #07090f);
    color: #eaeaf0;
}

/* ---------------- ANIMATIONS ---------------- */

.fade-in {
    animation: fadeIn 0.8s ease forwards;
}

.slide-up {
    animation: slideUp 0.7s ease forwards;
}

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

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

/* ---------------- LAYOUT ---------------- */

.page {
    padding: 40px 20px;
}

.page-center {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page.wide {
    max-width: 1200px;
    margin: 0 auto;
}

/* ---------------- GLASS CARD ---------------- */

.glass {
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(14px);
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 30px 60px rgba(0,0,0,0.4);
}

/* ---------------- UPLOAD ---------------- */

.upload-card {
    padding: 40px;
    max-width: 420px;
    width: 100%;
    text-align: center;
}

.subtitle {
    color: #95a5e2;
    margin-bottom: 22px;
}

.file-box {
    display: block;
    border: 2px dashed #7894ea;
    padding: 26px;
    border-radius: 14px;
    cursor: pointer;
    margin-bottom: 22px;
    transition: border 0.3s ease, background 0.3s ease;
}

.file-box:hover {
    border-color: #7fa1ff;
    background: rgba(255,255,255,0.04);
}

.file-box span {
    font-weight: 600;
    color: #95a5e2;
}

.file-box input {
    display: none;
}

/* ---------------- BUTTON ---------------- */

.primary-btn {
    background: linear-gradient(135deg, #5c7cff, #7f9bff);
    color: #000000;
    padding: 14px 26px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(137, 161, 255, 0.4);
}

.primary-btn a {
    color: #fff;
    text-decoration: none;
}

/* ---------------- STYLE GRID ---------------- */

.header-section {
    text-align: center;
    margin-bottom: 50px;
}

.page-title {
    font-size: 34px;
}

.style-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 26px;
}

.style-card {
    text-align: center;
}

.Pre-img {
    background: transparent;
    border: none;
    width: 90%;
    cursor: pointer;
}

.style-card img {
    width: 85%;
    height: 190px;
    object-fit:fill;
    border-radius: 14px;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.style-card img:hover {
    transform: scale(1.05);
    box-shadow: 0 18px 40px rgba(255, 255, 255, 0.6);
}

.style-info h3 {
    margin-top: 14px;
    font-size: 16px;
}

/* ---------------- RESULT ---------------- */

.result-card {
    max-width: 540px;
    margin: 60px auto;
    padding: 30px;
    text-align: center;
}

.result-card img {
    width: 100%;
    max-height: 420px;
    object-fit: contain;
    border-radius: 14px;
    margin: 24px 0;
}

/* ---------------- TEXT ---------------- */

.hint {
    margin-top: 18px;
    font-size: 13px;
    color: #b9c3f9;
}


.preview-box {
    display: none;
    margin-bottom: 22px;
    text-align: center;
}

.preview-box img {
    width: 160px;
    height: 160px;
    object-fit: cover;
    border-radius: 14px;
    margin-bottom: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.preview-box p {
    font-size: 13px;
    color: #89ddf9;
    word-break: break-all;
}

/* -------- LOADING OVERLAY -------- */

#loadingOverlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 20, 0.85);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loader-card {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 18px;
    padding: 36px 42px;
    text-align: center;
    color: #eaeaf0;
    box-shadow: 0 30px 60px rgba(0,0,0,0.6);
    animation: fadeScale 0.4s ease;
}

.loader-card p {
    font-size: 16px;
    margin: 16px 0 6px;
}

.loader-card span {
    font-size: 13px;
    color: #9aa1c7;
}

/* -------- INLINE LOADER (STEP 2 → STEP 3) -------- */

#inlineLoader {
    display: none;
    justify-content: center;
    margin-top: 60px;
    margin-bottom: 80px;
    animation: fadeIn 0.4s ease;
}

#inlineLoader .loader-card {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 18px;
    padding: 30px 40px;
    text-align: center;
    color: #eaeaf0;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}

/* -------- INLINE LOADER -------- */

#inlineLoader {
    display: none;
    justify-content: center;
    margin: 60px 0 100px;
}

#inlineLoader .loader-card {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 18px;
    padding: 32px 42px;
    text-align: center;
    color: #eaeaf0;
    box-shadow: 0 30px 60px rgba(0,0,0,0.6);
}

/* Spinner(Loader) */
.spinner {
    width: 46px;
    height: 46px;
    border: 4px solid rgba(255,255,255,0.25);
    border-top: 4px solid #7f9bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 14px;
}

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

#inlineLoader p {
    font-size: 15px;
    margin: 6px 0;
}

#inlineLoader span {
    font-size: 13px;
    color: #9aa1c7;
}



/* ---------------------------------------------------- */
/* -------- STYLE SELECTION LOGIC -------- */

.style-card {
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.style-card.selected img {
    outline: 3px solid #45ff6a;
    box-shadow: 0 0 0 4px rgba(53, 251, 92, 0.834),
                0 20px 40px rgba(0,0,0,0.6);
    transform: scale(1.03);
}

.generate-wrapper {
    text-align: center;
    margin-top: 50px;
}

.generate-wrapper .primary-btn {
    min-width: 220px;
    opacity: 0.6;
}

.generate-wrapper .primary-btn:enabled {
    opacity: 1;
}

/* prevent accidental selection */
.style-card img {
    pointer-events: none;
}

.form-group {
    margin-bottom: 14px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 16px;
    margin-bottom: 6px;
    color: #cbd5f5;
}

.dark-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-size: 14px;     
    outline: none;
}

.dark-input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

.dark-input:focus {
    border-color: #6c8cff;
    background: rgba(255, 255, 255, 0.08);
}
