:root {
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --primary-color: #8b5cf6;
    --primary-hover: #7c3aed;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at top right, rgba(139, 92, 246, 0.15), transparent 400px),
                      radial-gradient(circle at bottom left, rgba(72, 179, 236, 0.1), transparent 400px);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.app-container {
    width: 100%;
    max-width: 1100px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    padding: 1rem 1.5rem;
    border-radius: 20px;
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

.logo-container {
    flex-shrink: 0;
}

.context-selectors {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    background: rgba(0,0,0,0.2);
    padding: 0.5rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.05);
}

.header-select-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.context-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header-select {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    padding: 0;
    padding-right: 1.5rem;
    background-position: right top 50%;
}
.header-select:focus { background: transparent; border: none; }

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

nav {
    display: flex;
    gap: 0.5rem;
    background: rgba(0,0,0,0.2);
    padding: 0.5rem;
    border-radius: 12px;
}

button {
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.nav-btn {
    background: transparent;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
}

.nav-btn:hover {
    color: var(--text-main);
}

.nav-btn.active {
    background: rgba(255,255,255,0.1);
    color: var(--text-main);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.view {
    display: none;
    flex-direction: column;
    gap: 1.5rem;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.view.active {
    display: flex;
}

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

.card {
    padding: 2rem;
    border-radius: 20px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: #cbd5e1;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.input-group, .select-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

input[type="text"], select, textarea {
    width: 100%;
    padding: 0.875rem 1.25rem;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.2);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary-color);
    background: rgba(0,0,0,0.4);
}

textarea {
    min-height: 120px;
    resize: vertical;
    margin-bottom: 1.5rem;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2394a3b8%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat, repeat;
    background-position: right .7em top 50%, 0 0;
    background-size: .65em auto, 100%;
}

select option {
    background: var(--bg-dark);
    color: white;
}

.primary-btn {
    background: var(--primary-color);
    color: white;
    padding: 0.875rem 1.5rem;
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.secondary-btn {
    background: rgba(255,255,255,0.1);
    color: var(--text-main);
    padding: 0.875rem 1.5rem;
}

.secondary-btn:hover {
    background: rgba(255,255,255,0.2);
}

.secondary-btn.danger:hover {
    background: var(--danger);
    color: white;
}

.full-width {
    width: 100%;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.status-msg {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--success);
    text-align: center;
    min-height: 1.5rem;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.tag {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 0.35rem 1rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.tag button {
    background: transparent;
    color: var(--text-muted);
    font-size: 1.2rem;
    padding: 0;
}

.tag button:hover { color: var(--danger); }

/* Generator Layout */
.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 850px) {
    .split-layout { grid-template-columns: 1fr; }
}

/* Custom Checkbox Design */
.criteria-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.criteria-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.criteria-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.level-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.custom-checkbox-wrapper {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background: rgba(0,0,0,0.2);
    border: 1px solid transparent;
    transition: all 0.2s;
}

.custom-checkbox-wrapper:hover {
    background: rgba(255,255,255,0.05);
}

.custom-checkbox-wrapper.active {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.5);
}

.custom-checkbox-wrapper input { display: none; }

.checkmark {
    height: 24px;
    width: 24px;
    background-color: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    margin-right: 16px;
    position: relative;
    transition: all 0.2s;
}

.custom-checkbox-wrapper input:checked ~ .checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 7px;
    top: 3px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.custom-checkbox-wrapper input:checked ~ .checkmark:after {
    display: block;
}

.empty-state {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 3rem 0;
}

/* History List & Class List */
.history-list, .list-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item, .list-item {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    transition: all 0.2s;
}

.list-item:hover {
    background: rgba(255,255,255,0.05);
}

.list-item.active {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.5);
}

.history-item p, .list-item p {
    flex: 1;
    line-height: 1.6;
    color: #e2e8f0;
    margin: 0;
    font-weight: 500;
}

.history-item-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-muted);
    padding: 0.5rem;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
}
.icon-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-main); }
.icon-btn.danger:hover { background: var(--danger); color: white; border-color: var(--danger); }

/* --- PRO / AI Features Styling --- */
.pro-feature.hidden {
    display: none !important;
}

.magic-btn {
    background: linear-gradient(135deg, #8b5cf6, #3b82f6);
    background-size: 200% 200%;
    animation: gradientShift 4s ease infinite;
    border: none;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}
.magic-btn:hover {
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
    transform: translateY(-2px);
}
@keyframes gradientShift { 
    0% { background-position: 0% 50%; } 
    50% { background-position: 100% 50%; } 
    100% { background-position: 0% 50%; } 
}

.loader {
    border: 3px solid rgba(255,255,255,0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.loader.hidden { display: none; }

.ai-enhancement-box {
    margin-top: 1rem;
    padding: 1.5rem;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Modal Styling */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s;
}
.modal.hidden {
    opacity: 0;
    pointer-events: none;
}
.modal-content {
    max-width: 500px;
    width: 90%;
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal.hidden .modal-content {
    transform: translateY(20px);
}
