:root {
    --primary-color: #00f3ff;
    --secondary-color: #bd00ff;
    --bg-dark: #0f172a;
    --glass-bg: rgba(15, 23, 42, 0.85);
    --border-glass: rgba(255, 255, 255, 0.1);
    --text-color: #ffffff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    background-image: url('Background.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 50px 0;
}

.background-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(65, 11, 85, 0.9));
    z-index: -1;
}

.container {
    width: 90%;
    max-width: 1100px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.6);
    text-align: center;
}

/* Typography & Inputs (Mantidos similares) */
h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 3.5rem;
    background: linear-gradient(90deg, #fff, var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
}

.slogan { color: #aaa; margin-bottom: 2rem; }
.highlight { color: var(--secondary-color); font-weight: bold; }

.input-group {
    display: flex; gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
}

input[type="text"] {
    flex: 1; background: transparent; border: none;
    padding: 15px; font-size: 1.1rem; color: #fff; outline: none;
}

button#generateBtn {
    background: linear-gradient(45deg, var(--secondary-color), var(--primary-color));
    border: none; padding: 15px 30px; border-radius: 8px;
    color: #fff; font-weight: bold; font-family: 'Orbitron', sans-serif;
    cursor: pointer; transition: 0.2s; position: relative; overflow: hidden;
}
button#generateBtn:hover { transform: translateY(-2px); box-shadow: 0 0 25px rgba(189, 0, 255, 0.6); }

/* --- Configurações & Presets --- */
.config-toggle {
    margin-top: 15px; color: var(--primary-color); cursor: pointer;
    font-size: 0.9rem; display: inline-block; padding: 5px 10px;
    transition: 0.3s;
}
.config-toggle:hover { text-shadow: 0 0 8px var(--primary-color); }

.advanced-options {
    margin-top: 15px; background: rgba(0, 0, 0, 0.4); padding: 20px;
    border-radius: 12px; border: 1px solid var(--border-glass);
    display: flex; flex-direction: column; gap: 15px;
}
.advanced-options.hidden { display: none; }

/* Presets Buttons */
.presets-container {
    display: flex; gap: 10px; align-items: center; justify-content: center;
    flex-wrap: wrap; margin-bottom: 10px; padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.preset-label { font-size: 0.8rem; color: #bbb; margin-right: 5px; }
.preset-btn {
    background: rgba(255,255,255,0.05); border: 1px solid var(--border-glass);
    color: #ddd; padding: 6px 12px; border-radius: 20px; cursor: pointer;
    font-size: 0.75rem; transition: 0.2s;
}
.preset-btn:hover { border-color: var(--primary-color); color: #fff; background: rgba(0, 243, 255, 0.1); }

.option-row { display: flex; gap: 15px; justify-content: space-between; }
.opt-group { flex: 1; display: flex; flex-direction: column; text-align: left; }
.opt-group label { font-size: 0.8rem; color: #bbb; margin-bottom: 5px; }
.opt-group input {
    background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-glass);
    padding: 10px; border-radius: 6px; color: #fff; outline: none;
}
.full-width { width: 100%; }

/* --- Galeria & Histórico --- */
.image-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px; margin-top: 20px;
}
.result-card, .history-card {
    background: rgba(0, 0, 0, 0.4); border-radius: 12px; overflow: hidden;
    border: 1px solid var(--border-glass); transition: 0.3s;
    position: relative; aspect-ratio: 1 / 1; cursor: pointer;
}
.result-card:hover, .history-card:hover {
    border-color: var(--primary-color); transform: scale(1.02);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
}
.result-card img, .history-card img { width: 100%; height: 100%; object-fit: cover; }

/* Histórico */
.history-section { margin-top: 4rem; border-top: 1px solid var(--border-glass); padding-top: 2rem; }
.history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.left-controls { display: flex; gap: 15px; align-items: center; }
.left-controls h2 { font-family: 'Orbitron'; font-size: 1.4rem; color: #ddd; }

.icon-btn { background: transparent; border: none; color: var(--primary-color); cursor: pointer; font-size: 1.2rem; }
.clear-btn {
    background: transparent; border: 1px solid #ff4d4d; color: #ff4d4d;
    padding: 6px 12px; border-radius: 6px; cursor: pointer; transition: 0.2s;
}
.clear-btn:hover { background: #ff4d4d; color: #fff; }

.history-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px; transition: all 0.5s ease;
}
.history-grid.hidden { display: none; } /* Classe para esconder */

/* --- MODAL (POPUP) --- */
.modal {
    position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.9); backdrop-filter: blur(8px);
    display: flex; justify-content: center; align-items: center;
    opacity: 0; visibility: hidden; transition: opacity 0.3s ease;
}
.modal.show { opacity: 1; visibility: visible; }

.modal-content-wrapper {
    background: rgba(20, 20, 30, 0.9); border: 1px solid var(--border-glass);
    border-radius: 15px; padding: 20px; max-width: 90%; max-height: 90vh;
    display: flex; flex-direction: column; align-items: center; gap: 15px;
    box-shadow: 0 0 50px rgba(0, 243, 255, 0.15);
}

.modal-image {
    max-width: 100%; max-height: 70vh; border-radius: 8px;
    object-fit: contain;
}

.modal-info { text-align: center; width: 100%; color: #fff; }
.modal-info h3 {
    font-size: 1rem; color: #fff; margin-bottom: 10px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 600px;
}
.modal-meta {
    display: flex; gap: 20px; justify-content: center; font-size: 0.85rem; color: #aaa; margin-bottom: 15px;
}
.modal-meta i { color: var(--primary-color); margin-right: 5px; }

.download-btn {
    display: inline-block; padding: 10px 20px; background: var(--primary-color);
    color: #000; text-decoration: none; border-radius: 5px; font-weight: bold;
    font-size: 0.9rem; transition: 0.2s;
}
.download-btn:hover { background: #fff; box-shadow: 0 0 15px var(--primary-color); }

.close-modal {
    position: absolute; top: 20px; right: 30px; color: #fff;
    font-size: 40px; font-weight: bold; cursor: pointer; transition: 0.2s;
}
.close-modal:hover { color: var(--primary-color); transform: scale(1.1); }

/* Loading */
.hidden { display: none !important; }
#loading { margin: 20px auto; color: var(--primary-color); }
.spinner {
    width: 30px; height: 30px; border: 3px solid rgba(255,255,255,0.1);
    border-left-color: var(--primary-color); border-radius: 50%;
    animation: spin 1s linear infinite; margin: 0 auto 10px;
}
@keyframes spin { 100% { transform: rotate(360deg); } }
