:root {
    --bg-gradient: radial-gradient(circle at 20% 20%, #1f1f2e, #0d0d15);
    --card-bg: rgba(30, 30, 40, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);

    --accent: #8b5cf6;
    --accent-2: #06b6d4;
    --primary: #6366f1;

    --text-main: #f5f5f5;
    --text-muted: #9ca3af;
}

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

body {
    margin: 0;
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

/* ================= CONTAINER ================= */

.container {
    width: 100%;
    max-width: 1100px;
    padding: 2.5rem;
    border-radius: 20px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* ================= HEADER ================= */

header {
    text-align: center;
    margin-bottom: 2.5rem;
}

h1 {
    font-size: 2.2rem;
    margin: 0;
    margin-bottom: -1.5rem;
    font-weight: 800;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.info-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 16px;
    height: 16px;
    background-color: var(--glass-bg);
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: bold;
    cursor: help;
    font-family: 'Fira Code', monospace;
    transition: all 0.2s;
    position: relative;
    /* Needed for tooltip positioning */
}

.info-icon:hover {
    background-color: var(--accent);
    color: #000;
}

/* Custom Tooltip */
.info-icon:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 125%;
    /* Position above the icon */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: normal;
    min-width: 200px;
    text-align: center;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    z-index: 100;
    pointer-events: none;
    font-weight: normal;
}

header p,
footer p {
    margin-top: 2rem;
    color: var(--text-muted);
    font-size: 1rem;
}

footer p {
    font-size: 0.9rem;
}

/* ================= CONTROLS ================= */

.controls {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 2.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}


input[type="number"],
input[type="file"] {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.8rem 1rem;
    border-radius: 10px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3);
}

.settings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
}

/* ================= BUTTON ================= */

.button-group {
    display: flex;
    gap: 1rem;
}

.button-group button {
    flex: 1;
}

button {
    padding: 0.8rem 1rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    color: white;
    transition: all 0.25s ease;
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(139, 92, 246, 0.5);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* ================= SEPARATOR & GENERATION ================= */

.separator {
    border: 0;
    height: 1px;
    background: var(--glass-border);
    margin: 1rem 0;
}

.generation-settings h3 {
    grid-column: 1 / -1;
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    color: var(--accent-2);
}

/* ================= OUTPUT AREA ================= */

.output-container {
    display: grid;
    gap: 2rem;
    align-items: start;
}

@media (min-width: 800px) {
    .output-container {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 800px) {
    .container {
        padding: 1.5rem;
    }

    body {
        padding: 1rem;
    }
}

.logs-section,
.result-section {
    display: flex;
    flex-direction: column;
}

.button-container {
    justify-content: flex-end;
}

.logs-section h3,
.result-section h3 {
    margin-top: 0;
    margin-bottom: 0.8rem;
    font-weight: 600;
    color: var(--accent-2);
    line-height: 1.2;
}

/* ================= TERMINAL STYLE ================= */

.logs-box,
.output-box {
    background: #0a0a0f;
    border-radius: 12px;
    padding: 1rem;
    height: 320px;
    overflow-y: auto;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.6);
    margin: 0;
}

.logs-box {
    color: #22c55e;
}

.output-box {
    color: #ffffff;
}

/* ================= SELECTION & PREVIEW ================= */

.radio-group {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-main);
}

.hidden {
    display: none;
}

select {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.8rem 1rem;
    border-radius: 10px;
    font-size: 0.95rem;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: var(--accent);
}

.preview-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.8rem;
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
    height: 150px;
    overflow-y: auto;
    white-space: pre-wrap;
    margin-top: -0.4rem;
}

.file-stats {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--accent-2);
    font-weight: normal;
}

/* ================= SCROLLBAR ================= */

.logs-box::-webkit-scrollbar,
.output-box::-webkit-scrollbar,
.preview-box::-webkit-scrollbar {
    width: 8px;
}

.logs-box::-webkit-scrollbar-thumb,
.output-box::-webkit-scrollbar-thumb,
.preview-box::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

/* ================= MODAL & SOURCE VIEW ================= */

.link-btn {
    background: none;
    border: none;
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    padding: 0;
}

.link-btn:hover {
    color: var(--accent-2);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #1e1e1e;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
}

.modal-header h3 {
    margin: 0;
    font-family: 'Fira Code', monospace;
    font-size: 1rem;
    color: var(--text-main);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.5rem;
    box-shadow: none;
}

.close-btn:hover {
    color: var(--text-main);
    transform: none;
    box-shadow: none;
}

.code-block {
    margin: 0;
    padding: 1.5rem;
    overflow: auto;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: #e0e0e0;
    line-height: 1.5;
    tab-size: 2;
}

.code-block::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.code-block::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
}

/* ================= LINKS ================= */

a {
    color: var(--accent);
    transition: color 0.2s;
    text-decoration: none;
}

a:hover {
    color: var(--accent-2);
    text-decoration: underline;
}

/* ================= NOTIFICATIONS ================= */

.notification-area {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
}

.notification-toast {
    background: rgba(30, 30, 40, 0.95);
    color: var(--text-main);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    font-size: 0.9rem;
    min-width: 300px;
}

.notification-toast.show {
    transform: translateX(0);
}

.notification-toast.error {
    border-left: 4px solid #ef4444;
}

.notification-toast.success {
    border-left: 4px solid #22c55e;
}

.notification-toast.info {
    border-left: 4px solid var(--accent);
}

.progress {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-wrapper {
    width: 100%;
    height: 10px;
    background: #222;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #333;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #bb86fc, #03dac6);
    transition: width 0.15s ease-out;
}

.nowrap {
    white-space: nowrap;
}