:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #38bdf8;
    --accent-glow: #0ea5e9;
    --btn-gradient: linear-gradient(135deg, #3b82f6 0%, #2dd4bf 100%);
    --font-main: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Background Animation */
.background-globes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 10s infinite ease-in-out;
}

.globe-1 {
    width: 400px;
    height: 400px;
    background: #4f46e5;
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.globe-2 {
    width: 500px;
    height: 500px;
    background: #06b6d4;
    bottom: -150px;
    right: -100px;
    animation-delay: 2s;
}

.globe-3 {
    width: 300px;
    height: 300px;
    background: #db2777;
    top: 40%;
    left: 40%;
    transform: translate(-50%, -50%);
    animation-delay: 4s;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-20px) scale(1.05);
    }
}

/* Container */
.container {
    width: 100%;
    max-width: 600px;
    padding: 2rem;
    z-index: 1;
}

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

header h1 {
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: -0.05em;
    background: linear-gradient(to right, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 300;
}

/* Card */
.generator-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Controls */
.control-group {
    margin-bottom: 2rem;
}

label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.select-wrapper {
    position: relative;
}

select {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-family: var(--font-main);
    cursor: pointer;
    appearance: none;
    transition: all 0.3s ease;
}

select:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.1);
}

.select-wrapper::after {
    content: '▼';
    font-size: 0.8rem;
    color: var(--text-secondary);
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* Output Area */
.output-area {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 2rem;
    min-height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.output-area:hover {
    border-color: rgba(255, 255, 255, 0.05);
}

#generated-phrase {
    font-size: 1.4rem;
    line-height: 1.5;
    font-weight: 500;
}

.placeholder {
    color: rgba(148, 163, 184, 0.5);
    font-style: italic;
}

/* Button */
button {
    width: 100%;
    background: var(--btn-gradient);
    border: none;
    padding: 1.25rem;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(56, 189, 248, 0.4), 0 4px 6px -2px rgba(56, 189, 248, 0.2);
}

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

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(100%);
}

.btn-icon {
    font-size: 1.2rem;
}

/* Responsive */
@media (max-width: 480px) {
    header h1 {
        font-size: 2.5rem;
    }

    .generator-card {
        padding: 1.5rem;
    }

    #generated-phrase {
        font-size: 1.1rem;
    }
}

/* --- Admin UI Styles --- */

.hidden {
    display: none !important;
}

/* Control Header (Select + Admin Btn) */
.control-header {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 2rem;
}

.control-header .control-group {
    margin-bottom: 0;
    flex-grow: 1;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    width: 54px;
    /* Match height of select input approx */
    height: 54px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(30deg);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.modal-content {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    color: white;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: white;
}

/* Dashboard List */
.toolbar {
    margin-bottom: 1.5rem;
    text-align: right;
}

.persona-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.persona-item {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.persona-item:hover {
    background: rgba(56, 189, 248, 0.1);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.persona-item-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.persona-item-id {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: monospace;
}

/* Editor Form */
.editor-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.text-btn {
    background: none;
    border: none;
    color: var(--accent-color);
    font-weight: 600;
    cursor: pointer;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-family: var(--font-main);
}

.columns-editor {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .columns-editor {
        grid-template-columns: 1fr;
    }
}

.column-group textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-secondary);
    padding: 0.75rem;
    font-family: var(--font-main);
    resize: vertical;
    min-height: 200px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.primary-btn {
    background: var(--btn-gradient);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.danger-btn {
    background: rgba(220, 38, 38, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(220, 38, 38, 0.5);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-right: auto;
    /* Push to left */
}

/* Login View */
.login-container {
    text-align: center;
    max-width: 300px;
    margin: 2rem auto;
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.full-width {
    width: 100%;
}

.error-msg {
    color: #fca5a5;
    margin-top: 1rem;
    font-size: 0.9rem;
}