/* Hogar Creativo Sonido - Sleek Premium Dark Theme styling */

:root {
    --bg-main: #09090b; /* Zinc 950 */
    --bg-card: #09090b; /* Zinc 950 */
    --bg-input: #18181b; /* Zinc 900 */
    --text-main: #f4f4f5; /* Zinc 100 */
    --text-muted: #a1a1aa; /* Zinc 400 */
    --primary: #ffffff;
    --primary-hover: #e4e4e7; /* Zinc 200 */
    --accent: #2563eb; /* Royal Blue */
    --accent-hover: #1d4ed8;
    --danger: #ef4444; /* Red 500 */
    --danger-hover: #dc2626;
    --border-color: #27272a; /* Zinc 800 */
    --border-hover: #3f3f46; /* Zinc 700 */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --border-radius: 8px;
    --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
    letter-spacing: -0.011em;
}

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

a {
    color: var(--text-main);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: var(--transition);
}

a:hover {
    border-bottom: 1px solid var(--text-main);
}

/* Layout */
.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
}

header {
    background-color: var(--bg-main);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: -0.03em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-item {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
}

.nav-item:hover, .nav-item.active {
    color: var(--text-main);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-left: 1px solid var(--border-color);
    padding-left: 1.5rem;
}

.credits-badge {
    color: var(--text-main);
    font-weight: 700;
    background: var(--bg-input);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.65rem 1.25rem;
    border-radius: var(--border-radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary);
    color: #000000;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--bg-input);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

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

.btn-danger {
    background-color: transparent;
    color: var(--danger);
    border: 1px solid var(--border-color);
}

.btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
}

.btn-accent {
    background-color: transparent;
    color: var(--accent);
    border: 1px solid var(--border-color);
}

.btn-accent:hover {
    background-color: rgba(37, 99, 235, 0.1);
    border-color: var(--accent);
}

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

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.25rem;
}

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

.form-control {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: var(--border-radius);
    padding: 0.65rem 0.9rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

textarea.form-control {
    resize: vertical;
}

.form-range {
    width: 100%;
    accent-color: var(--primary);
    background: var(--border-color);
    height: 4px;
    border-radius: 2px;
    outline: none;
}

.form-inline {
    display: inline-flex;
    gap: 0.35rem;
    align-items: center;
}

/* Cards & Containers */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2.25rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

/* Login Page */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    padding: 6rem 0;
}

.auth-card {
    width: 100%;
    max-width: 360px;
}

.auth-header {
    text-align: center;
    margin-bottom: 1.25rem;
}

.auth-header h1 {
    font-size: 1.35rem;
    margin-bottom: 0.25rem;
    letter-spacing: -0.03em;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Alerts */
.alert {
    padding: 0.65rem 0.85rem;
    border-radius: var(--border-radius);
    margin-bottom: 0.85rem;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: #fca5a5;
}

.alert-success {
    background-color: rgba(37, 99, 235, 0.1);
    border: 1px solid var(--accent);
    color: #93c5fd;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 2rem;
    margin-top: 1.5rem;
    margin-bottom: 2.5rem;
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Output Display Area */
.output-card {
    display: flex;
    flex-direction: column;
    min-height: 480px;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    background-color: #0e0e11;
    padding: 2.25rem;
    border: 1px solid var(--border-color);
}

.placeholder-view {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

.placeholder-view h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.placeholder-view p {
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.generation-result-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Loading/Status Polling styles */
.loading-view {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.progress-bar-container {
    width: 160px;
    height: 2px;
    background-color: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar-fill {
    height: 100%;
    width: 10%;
    background-color: var(--primary);
    border-radius: 10px;
    animation: progressPulse 1.8s ease-in-out infinite;
}

@keyframes progressPulse {
    0% { width: 10%; }
    50% { width: 90%; }
    100% { width: 10%; }
}

.status-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
}

.status-log {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Advanced details panel */
.advanced-settings summary {
    user-select: none;
}
.advanced-settings[open] summary {
    margin-bottom: 1rem;
}

/* Gallery / History Section */
.gallery-section {
    margin-top: 2.5rem;
    margin-bottom: 2.5rem;
}

.gallery-section h2 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* History List Layout */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    transition: var(--transition);
}

.history-item:hover {
    border-color: var(--border-hover);
}

.history-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-text {
    font-size: 0.9rem;
    color: var(--text-main);
    font-style: italic;
}

.history-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.meta-tag {
    font-size: 0.7rem;
    background-color: var(--bg-input);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.history-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.history-audio {
    height: 38px;
    border-radius: 4px;
}

@media (max-width: 768px) {
    .history-item {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    .history-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    .history-audio {
        width: 100%;
    }
}

/* Admin panel tables */
.admin-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.table-wrapper {
    overflow-x: auto;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.8rem;
}

th, td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: #121214;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #121214;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.badge-admin {
    background-color: rgba(168, 85, 247, 0.1);
    color: #d8b4fe;
    border: 1px solid rgba(168, 85, 247, 0.2);
}

.badge-user {
    background-color: rgba(161, 161, 170, 0.1);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.badge-active {
    background-color: rgba(34, 197, 94, 0.1);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.badge-blocked {
    background-color: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Footer */
footer {
    background-color: var(--bg-main);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 3rem;
}
