/* style.css - Premium Glassmorphism Design */

:root {
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --blur: 10px;
    --primary-color: #4a90e2;
    --text-color: #333;
    --text-light: #f5f5f5;
    --card-bg: rgba(255, 255, 255, 0.25);
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-color);
    overflow-x: hidden;
}

/* Background Shapes */
.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    animation: move 10s infinite alternate;
}

.shape-1 {
    top: -100px;
    left: -100px;
    width: 400px;
    height: 400px;
    background: #ff9a9e;
}

.shape-2 {
    bottom: -100px;
    right: -100px;
    width: 300px;
    height: 300px;
    background: #a18cd1;
}

@keyframes move {
    from {
        transform: translate(0, 0);
    }

    to {
        transform: translate(50px, 50px);
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-light);
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Filters */
.filters {
    background: rgba(0, 0, 0, 0.2);
    /* Darker tinted background for better contrast */
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    box-shadow: var(--glass-shadow);
}

.input-group {
    display: flex;
    flex-direction: column;
}

label {
    margin-bottom: 0.5rem;
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 500;
}

input,
select,
button {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    /* Changed specifically for dark bg */
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

/* Fix for company selector options - ensure they are readable */
select option {
    background-color: white;
    color: #333;
}

input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

input:focus,
select:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

/* Make date picker icon white-ish if possible or rely on browser */
::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

button {
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    font-weight: 600;
    margin-top: auto;
    /* Align with inputs */
}

button:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

/* Summary Board */
.summary-board {
    margin-bottom: 2rem;
    animation: fadeIn 0.5s ease-out;
}

.summary-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--glass-shadow);
    display: inline-block;
    min-width: 200px;
}

.summary-card h3 {
    margin: 0;
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.summary-card p {
    margin: 0;
    color: white;
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Content Area */
#planning-results {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.resource-group {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--glass-shadow);
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.resource-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    /* Indicates clickable */
    user-select: none;
    transition: background 0.2s;
}

.resource-header:hover {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* Chevron indicator */
.resource-header::after {
    content: '▼';
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.resource-header.collapsed::after {
    transform: rotate(-90deg);
}

.slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    transition: all 0.3s ease;
}

.slots-grid.hidden {
    display: none;
}

.resource-name {
    font-size: 1.5rem;
    font-weight: 600;
}

.resource-count {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.slot-card {
    background: var(--card-bg);
    /* Lighter bg for cards */
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.2s;
    /* Since card bg is light, text should be dark for readability */
    color: #333;
}

.slot-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.4);
}

.slot-detail {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    line-height: 1.4;
}

.slot-label {
    font-weight: 600;
    color: #555;
    font-size: 0.85rem;
    display: block;
    margin-bottom: 0.1rem;
}

.empty-state {
    text-align: center;
    color: var(--text-light);
    padding: 3rem;
    font-size: 1.2rem;
}

/* Nested Grouping Styles */
.group-container {
    padding-left: 1rem;
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.group-container.hidden {
    display: none;
}

.group-header {
    background: rgba(255, 255, 255, 0.15);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-light);
    transition: background 0.2s;
    font-size: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.group-header:hover {
    background: rgba(255, 255, 255, 0.25);
}

.group-header::after {
    content: '▼';
    font-size: 0.7rem;
    transition: transform 0.3s ease;
    margin-left: 10px;
}

.group-header.collapsed::after {
    transform: rotate(-90deg);
}

/* Specific Level Styling */
.header-program {
    /* Level 1: Programa */
    background: rgba(74, 144, 226, 0.3);
    /* Stronger blue */
    font-weight: 700;
    color: white;
}

.header-day {
    /* Level 2: Day Type */
    background: rgba(74, 144, 226, 0.15);
    font-weight: 600;
    margin-left: 0.5rem;
}

.header-sede {
    /* Level 3: Sede */
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.95rem;
    margin-left: 1rem;
}

.header-salon {
    /* Level 4: Salon */
    background: rgba(0, 0, 0, 0.1);
    font-size: 0.9rem;
    font-style: italic;
    margin-left: 1.5rem;
}

/* Adjust card grid when deep inside */
.slots-grid-nested {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    padding: 1rem 0 1rem 2rem;
}

.slots-grid-nested.hidden {
    display: none;
}

/* Dialog Styles */
dialog {
    background: white;
    border-radius: 12px;
    border: none;
    padding: 2rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    margin: auto;
    width: 100%;
    max-width: 350px;
    color: #333;
}

dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

dialog h2,
dialog h3 {
    margin-top: 0;
    color: #333;
    margin-bottom: 0.5rem;
}

dialog p {
    color: #666;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

dialog label {
    display: block;
    color: #333;
    margin-bottom: 0.5rem;
    text-align: left;
}

dialog input {
    background: white;
    border: 1px solid #ccc;
    color: #333;
    width: 100%;
    box-sizing: border-box;
    /* Fix padding issues */
    margin-bottom: 1.5rem;
}

dialog input:focus {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn-primary {
    background: var(--primary-color) !important;
    color: white !important;
}

.btn-danger {
    background: #d9534f !important;
    color: white !important;
}

.btn-secondary {
    background: #ccc !important;
    color: #333 !important;
}

dialog button {
    margin-top: 0;
}

#login-error {
    color: #d9534f;
    font-size: 0.85rem;
    margin-top: -1rem;
    margin-bottom: 1rem;
    display: none;
    text-align: left;
}