/* public/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --bg-dark: #050505;
    --bg-card: rgba(20, 20, 20, 0.6);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --border-color: rgba(255, 255, 255, 0.08);
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --accent: #a855f7;
    --text-main: #ffffff;
    --text-muted: #a1a1aa;
    --font-main: 'Inter', sans-serif;
    --font-display: 'Plus Jakarta Sans', sans-serif;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(168, 85, 247, 0.08), transparent 25%);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Typography --- */
h1,
h2,
h3,
h4 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-main);
}

/* --- Navigation --- */
#top-menu-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 64px;
    background: rgba(5, 5, 5, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 1000;
    transition: all 0.3s ease;
}

.menu-group-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    background: linear-gradient(135deg, #fff 0%, #a1a1aa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.03em;
}

/* --- Credits & Profile --- */
#credits-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: 12px;
}

.buy-credits-btn {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.buy-credits-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

#credit-display {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
}

#profile-button {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s var(--ease-out);
}

#profile-button:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

#profile-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: #111;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    min-width: 180px;
    display: none;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    animation: slideDown 0.2s var(--ease-out);
}

#profile-dropdown.show {
    display: block;
}

#profile-dropdown a {
    display: block;
    padding: 10px 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    border-radius: 6px;
    transition: all 0.2s;
}

#profile-dropdown a:hover {
    background: var(--bg-glass);
    color: #fff;
}

/* --- Hero Section --- */
.generator-hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.hero-content {
    text-align: center;
    max-width: 800px;
    width: 100%;
    z-index: 10;
    animation: fadeUp 0.8s var(--ease-out);
}

.hero-title {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    background: linear-gradient(180deg, #fff 0%, #a1a1aa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.04em;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
    font-weight: 400;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* --- Input Interface --- */
.input-interface {
    background: rgba(20, 20, 20, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
    width: 100%;
    transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}

.input-interface:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 30px 100px rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
}

.input-row {
    display: flex;
    gap: 12px;
    padding: 4px;
}

.main-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    padding: 12px 16px;
    font-family: var(--font-main);
}

.main-input::placeholder {
    color: #555;
}

.main-input:focus {
    outline: none;
}

.secondary-inputs {
    display: flex;
    gap: 8px;
    padding: 0 12px 12px 12px;
}

.sub-input {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 10px 16px;
    color: #fff;
    font-size: 0.9rem;
    transition: all 0.2s;
}

/* Give description more space */
.sub-input:first-of-type {
    flex: 2;
}

.sub-input:nth-of-type(2) {
    flex: 1;
}

.sub-input:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    outline: none;
}

.select-wrapper {
    position: relative;
    flex: 0 0 180px;
}

.custom-select {
    width: 100%;
    appearance: none;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 10px 16px;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.custom-select:hover {
    background: rgba(255, 255, 255, 0.06);
}

.custom-select option {
    background: #111;
    color: #fff;
}

.generate-btn {
    background: #fff;
    color: #000;
    border: none;
    border-radius: 16px;
    padding: 0 32px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.generate-btn:hover:not(:disabled) {
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

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

.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.85rem;
    user-select: none;
}

/* Custom Toggle Switch */
.toggle-wrapper input {
    appearance: none;
    width: 36px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    position: relative;
    transition: background 0.2s;
    cursor: pointer;
    margin: 0;
}

.toggle-wrapper input::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.toggle-wrapper input:checked {
    background: var(--primary);
}

.toggle-wrapper input:checked::after {
    transform: translateX(16px);
}

/* --- Loading Overlay --- */
#loading-overlay {
    position: fixed;
    inset: 0;
    background: #050505;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

#loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.loader-visual {
    width: 200px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 24px;
    position: relative;
}

.loader-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    box-shadow: 0 0 20px var(--primary);
    transition: width 0.3s ease;
}

.loader-text {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 8px;
    font-weight: 500;
}

.loader-subtext {
    font-family: 'Courier New', monospace;
    color: var(--text-muted);
    font-size: 0.9rem;
    opacity: 0.7;
}

/* --- Animations --- */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- My Websites Page Styles --- */
.container {
    max-width: 1000px;
    margin: 100px auto 40px;
    padding: 0 20px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
}

.websites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.site-card {
    background: rgba(20, 20, 20, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s var(--ease-out);
    position: relative;
    overflow: hidden;
}

.site-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.site-card h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.site-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.site-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: #fff;
    color: #000;
}

.btn-primary:hover {
    background: #e0e0e0;
}

.btn-outline {
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.btn-outline:hover {
    border-color: #fff;
    color: #fff;
}

.delete-site-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: #555;
    cursor: pointer;
    transition: color 0.2s;
}

.delete-site-btn:hover {
    color: #ef4444;
}

/* --- Status Popup (Toast) --- */
#status-popup {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    padding: 12px 24px;
    border-radius: 50px;
    color: #fff;
    font-size: 0.9rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s var(--ease-out);
    z-index: 10000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

#status-popup.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}