:root {
    /* Light Mode Palette */
    --bg-gradient: linear-gradient(135deg, #f0f9ff 0%, #e0e7ff 100%);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    /* Whiter border for 'frosted' look */
    --card-bg: rgba(255, 255, 255, 0.85);
    /* Much more opaque for readability */

    --primary: #4f46e5;
    /* Intense Indigo for contrast */
    --primary-hover: #4338ca;

    --text: #1e293b;
    /* Slate 800 - High contrast dark */
    --text-muted: #64748b;
    /* Slate 500 */

    --danger: #ef4444;
    --success: #10b981;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-gradient);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Background Animation - Subtle shifting shapes */
.background-globes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background:
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.10) 0%, transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.10) 0%, transparent 25%);
    filter: blur(40px);
}

/* Layout & Views */
.view-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    position: absolute;
    width: 100%;
}

.view-container.active {
    opacity: 1;
    pointer-events: all;
    position: relative;
}

.hidden {
    display: none !important;
}

/* Components */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.btn-primary,
.btn-secondary,
.btn-small {
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.025em;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
    background: white;
    color: var(--text);
    border: 1px solid #e2e8f0;
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-small {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    border-radius: 8px;
}

.danger {
    background-color: #fee2e2;
    color: #b91c1c;
}

.danger:hover {
    background-color: #fecaca;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    margin-top: 0.5rem;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    color: var(--text);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Login View */
#login-view {
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.8) 0%, transparent 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.logo-area {
    margin-bottom: 2.5rem;
}

.logo-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-card h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.input-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.input-group label {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Dashboard */
.glass-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-btn:hover {
    color: var(--primary);
    background: #f0f9ff;
}

.nav-btn.active {
    color: var(--primary);
    background: #e0e7ff;
    font-weight: 600;
}

.content-area {
    padding: 3rem 5%;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeUp 0.4s ease-out;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Forms */
.form-card {
    max-width: 700px;
    margin: 0 auto;
}

.card-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 1rem;
}

.card-header h2 {
    font-size: 1.5rem;
    color: var(--text);
}

.row {
    display: flex;
    gap: 1.5rem;
}

.row .input-group {
    flex: 1;
}

.large-btn {
    width: 100%;
    margin-top: 1.5rem;
    font-size: 1.1rem;
    padding: 1rem;
}

.readonly {
    background: #f1f5f9;
    color: var(--text-muted);
    border-color: #e2e8f0;
}

/* Result Box */
.result-box {
    margin-top: 2rem;
    padding: 2.5rem;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #a7f3d0;
    border-radius: 20px;
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.big-number {
    display: block;
    font-size: 5rem;
    font-weight: 800;
    color: var(--success);
    margin: 1rem 0;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(16, 185, 129, 0.1);
}

.number-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

#res-tipo {
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #047857;
    letter-spacing: 2px;
    background: rgba(255, 255, 255, 0.6);
    padding: 0.5rem 1.2rem;
    border-radius: 30px;
}

/* Table Section */
.wide-card {
    width: 100%;
    padding: 0;
    overflow: hidden;
    background: white;
    /* Ensure solid background for table */
    border: 1px solid #e2e8f0;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.header-row h2 {
    font-size: 1.25rem;
    color: var(--text);
    font-weight: 700;
}

.btn-icon-text {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    border: 1px solid #cbd5e1;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon-text:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f0f9ff;
}

.table-responsive {
    overflow-x: auto;
}

.glass-table {
    width: 100%;
    border-collapse: collapse;
}

.glass-table th {
    text-align: left;
    padding: 1rem 2rem;
    background: white;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #f1f5f9;
}

.glass-table td {
    padding: 1.25rem 2rem;
    /* More breathing room */
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    font-size: 0.95rem;
    vertical-align: middle;
}

.glass-table tr:hover {
    background: #f8fafc;
}

.glass-table tr:last-child td {
    border-bottom: none;
}

/* Status Badges */
.status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-ativo {
    background: #dcfce7;
    color: #15803d;
}

.status-cancelado {
    background: #fee2e2;
    color: #b91c1c;
}

/* Admin */
.inline-form {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.inline-form input,
.inline-form select {
    margin: 0;
    flex: 1;
    background: white;
}

.inline-form button {
    flex: 0 0 auto;
}

/* Utilities */
.error-msg {
    color: var(--danger);
    margin-top: 0.5rem;
    font-size: 0.9rem;
    text-align: left;
}

@media (max-width: 768px) {
    .row {
        flex-direction: column;
        gap: 0;
    }

    .glass-nav {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
    }
}