:root {
    --bg-gradient: linear-gradient(135deg, #cbdceb 0%, #e2efd9 50%, #d8e6f3 100%);
    --glass-bg: rgba(255, 255, 255, 0.35);
    --card-bg: rgba(255, 255, 255, 0.45);
    --apple-green: #34c759;
    --apple-blue: #007aff;
    --text-main: #1d1d1f;
    --text-sec: #86868b;
    --border-glass: 1px solid rgba(255, 255, 255, 0.5);
    --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.04);
    --ease-apple: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out-back: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-main);
    overflow-x: hidden;
}

.dashboard {
    width: 95vw;
    max-width: 1300px;
    background: var(--glass-bg);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-radius: 48px;
    padding: 40px;
    border: var(--border-glass);
    box-shadow: 0 40px 80px rgba(0,0,0,0.03);
    animation: fadeInStagger 0.8s var(--ease-apple) forwards;
}

.main-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.main-header h1 { font-size: 28px; font-weight: 600; margin: 0; }

.header-icons { display: flex; align-items: center; gap: 20px; }
.icon-btn { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-main); transition: transform 0.2s var(--ease-apple); }
.icon-btn:hover { transform: scale(1.1); }
.user-avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: #eee; border: 2px solid white; box-shadow: var(--shadow-soft); transition: transform 0.2s var(--ease-apple); }
.user-avatar:hover { transform: scale(1.05); }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.main-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 24px; }

.card { 
    background: var(--card-bg); 
    border-radius: 28px; 
    border: var(--border-glass); 
    padding: 24px; 
    box-shadow: var(--shadow-soft); 
    transition: transform 0.4s var(--ease-out-back), box-shadow 0.4s var(--ease-apple); 
}
.card:hover { transform: translateY(-5px); box-shadow: 0 12px 40px rgba(0,0,0,0.06); }

.card-header { font-size: 14px; font-weight: 600; color: var(--text-main); margin-bottom: 16px; }
.card-header.uppercase { text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.6; }

/* Column 1: Plano */
.piano-section { display: flex; flex-direction: row; gap: 20px; }
.piano-layout { flex: 1; }
.tables-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 10px; }

.piano-stats { width: 100px; display: flex; flex-direction: column; gap: 24px; padding-left: 20px; border-left: 1px solid rgba(0,0,0,0.05); }
.icon-top { display: flex; justify-content: space-between; font-size: 18px; margin-bottom: 10px; }
.mini-icon { cursor: pointer; transition: transform 0.2s; }
.mini-icon:hover { transform: scale(1.2); }
.stat-label { font-size: 12px; font-weight: 600; margin-bottom: 8px; }

.mini-bars { display: flex; align-items: flex-end; gap: 6px; height: 60px; }
.mini-bar { width: 6px; background: rgba(0,0,0,0.08); border-radius: 3px; position: relative; transition: height 1.2s var(--ease-apple); }
.mini-bar::after { content: attr(data-label); position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 8px; font-weight: 500; color: var(--text-sec); }
.mini-bar.blue { background: var(--apple-blue); }

.mini-bars-vertical { display: flex; flex-direction: column; gap: 8px; }
.mini-bar-h { width: 100%; height: 6px; background: rgba(0,0,0,0.08); border-radius: 3px; position: relative; overflow: hidden; }
.mini-bar-h .fill { height: 100%; background: var(--apple-blue); border-radius: 3px; transition: width 1.2s var(--ease-apple); }

/* Table Component */
.table-wrapper { position: relative; width: 64px; height: 64px; margin: auto; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform 0.2s var(--ease-apple); }
.table-wrapper:hover { transform: scale(1.08); }
.table-wrapper:active { transform: scale(0.95); }

.table-surface { 
    width: 44px; height: 44px; background: rgba(0,0,0,0.08); border-radius: 12px; 
    display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; color: rgba(255,255,255,0.8);
    position: relative; z-index: 2; transition: all 0.4s var(--ease-apple);
}
.round .table-surface { border-radius: 50%; }

.chair { position: absolute; background: rgba(0,0,0,0.05); border-radius: 3px; z-index: 1; transition: all 0.4s var(--ease-apple); }
.c-top { width: 24px; height: 8px; top: 0px; }
.c-bottom { width: 24px; height: 8px; bottom: 0px; }
.c-left { width: 8px; height: 24px; left: 0px; }
.c-right { width: 8px; height: 24px; right: 0px; }

.occupied .table-surface { background: var(--apple-green); color: white; box-shadow: 0 4px 12px rgba(52, 199, 89, 0.3); }
.occupied .chair { background: rgba(52, 199, 89, 0.25); }
.occupied .table-surface::before { 
    content: '👤'; font-size: 10px; position: absolute; top: -5px; right: -5px; background: white; border-radius: 50%; 
    width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); animation: popIn 0.3s var(--ease-out-back); 
}

@keyframes popIn { from { transform: scale(0); } to { transform: scale(1); } }

/* Column 2: Middle Items */
.widgets-column { display: flex; flex-direction: column; gap: 24px; }
.donut-container { display: flex; align-items: center; gap: 20px; margin-top: 10px; }
.donut-chart { 
    width: 80px; height: 80px; border-radius: 50%; 
    background: conic-gradient(var(--apple-green) 0% 70%, #9ca3af 70% 100%);
    position: relative;
    transition: none; /* Handled by JS Animation Frame */
}
.donut-chart::after { content: ''; position: absolute; inset: 15px; background: #fffcf8; border-radius: 50%; }
.donut-legend { font-size: 11px; display: flex; flex-direction: column; gap: 4px; color: var(--text-sec); }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #9ca3af; margin-right: 4px; }
.dot.occupied { background: var(--apple-green); }
.legend-item .val { color: var(--apple-green); font-weight: 600; }

.compact-stat { display: flex; justify-content: space-between; align-items: center; }
.big-val { font-size: 28px; font-weight: 700; color: var(--apple-green); margin-top: 4px; transition: all 0.4s var(--ease-apple); }
.sub-val { font-size: 12px; color: var(--text-sec); font-weight: 500; }
.mini-chart-v { display: flex; align-items: flex-end; gap: 4px; height: 50px; }
.v-bar { width: 5px; background: rgba(0,0,0,0.08); border-radius: 2px; transition: height 1.2s var(--ease-apple); }
.v-bar.high { background: var(--apple-green); opacity: 0.6; }

.double-widgets { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.big-number { font-size: 24px; font-weight: 700; margin-top: 5px; }
.sub-text { font-size: 10px; font-weight: 500; color: var(--text-sec); margin-top: 4px; }
.blue-text { color: var(--apple-blue); }

/* Column 3: Right Items */
.staff-status-card { display: flex; flex-direction: column; height: 100%; }
.staff-list { flex: 1; margin-top: 10px; }
.staff-item { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid rgba(0,0,0,0.03); transition: background 0.2s; }
.staff-item:hover { background: rgba(0,0,0,0.01); }
.staff-item span:first-child { font-weight: 500; font-size: 15px; }
.staff-item .count { color: var(--apple-green); font-weight: 700; font-size: 15px; }

.footer-btn { background: rgba(0,0,0,0.04); border: none; padding: 10px; border-radius: 12px; font-size: 12px; font-weight: 600; color: var(--text-sec); width: 100%; cursor: pointer; margin-top: 20px; transition: all 0.2s; }
.footer-btn:hover { background: rgba(0,0,0,0.08); color: var(--text-main); }

.occupancy-summary { background: rgba(255, 255, 255, 0.55); position: relative; overflow: hidden; }
.big-number-xl { font-size: 52px; font-weight: 700; color: var(--apple-blue); margin: 10px 0; transition: all 0.4s var(--ease-apple); }
.comparison { font-size: 12px; color: var(--text-sec); font-weight: 500; }

/* Center Text */
.center { text-align: center; }

/* Responsive Design */
@media screen and (max-width: 1210px) {
    .dashboard { padding: 30px; border-radius: 36px; }
    .main-grid { gap: 20px; }
}

@media screen and (max-width: 1024px) {
    .main-grid { 
        grid-template-columns: 1.4fr 1fr; 
        gap: 20px;
    }
    
    /* Let them flow naturally, or specify columns */
    .piano-section { grid-column: 1; grid-row: span 2; }
    .widgets-column { grid-column: 2; }
    .staff-status-card { grid-column: 2; }

    .dashboard { width: 98vw; padding: 25px; border-radius: 32px; }
    
    /* Hide the redundant smaller occupancy card in the middle column */
    .widgets-column .double-widgets .card:first-child { display: none; }
    .double-widgets { grid-template-columns: 1fr; }
}

@media screen and (max-width: 768px) {
    .dashboard { 
        padding: 20px; 
        border-radius: 20px; 
        width: 100vw; 
        margin: 0; 
        border: none;
        box-shadow: none;
    }
    
    .main-header { margin-bottom: 20px; flex-direction: row; justify-content: space-between; align-items: center; }
    .main-header h1 { font-size: 20px; }
    
    .main-grid { 
        grid-template-columns: 1fr; 
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    
    .piano-section { flex-direction: column; }
    
    .piano-stats { 
        width: 100%; 
        flex-direction: row; 
        padding-left: 0; 
        border-left: none; 
        justify-content: space-around;
        padding-top: 15px;
        border-top: 1px solid rgba(0,0,0,0.05);
        margin-top: 16px;
    }
    
    .tables-grid { 
        grid-template-columns: repeat(3, 1fr); 
        gap: 12px; 
    }
    
    .table-wrapper { width: 50px; height: 50px; }
    .table-surface { width: 36px; height: 36px; font-size: 12px; }
    
    .double-widgets .card:first-child { display: none; }
    .double-widgets { grid-template-columns: 1fr; }
    
    .big-number-xl { font-size: 42px; }
    .staff-item { padding: 10px 0; }
}

@media screen and (max-width: 480px) {
    .tables-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .table-wrapper { width: 45px; height: 45px; }
    .dashboard { padding: 15px; border-radius: 0; }
    .piano-stats { flex-wrap: wrap; gap: 10px; }
    .stat-item { flex: 1; min-width: 40%; }
}

/* Login Page Specifics */
.login-page {
    background: var(--bg-gradient);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 48px;
    text-align: center;
    border-radius: 40px;
    animation: popIn 0.8s var(--ease-apple) forwards;
}

.logo-circle {
    width: 64px;
    height: 64px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 24px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

.login-header h2 { font-size: 24px; font-weight: 700; margin: 0 0 8px; }
.login-header p { font-size: 14px; color: var(--text-sec); margin: 0 0 32px; }

.input-group { text-align: left; margin-bottom: 32px; }
.input-group label { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; color: var(--text-sec); padding-left: 4px; }

.login-select {
    width: 100%;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,0.05);
    background: rgba(255,255,255,0.5);
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%2386868b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 5 3 3 3-3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    transition: all 0.2s;
}

.login-select:hover { background: rgba(255,255,255,0.8); }
.login-select:focus { outline: none; border-color: var(--apple-blue); background: white; }

.login-btn {
    background: var(--apple-blue);
    color: white;
    font-size: 16px;
    padding: 16px;
    margin-top: 0;
    height: auto;
}
.login-btn:hover { background: #0066d6; transform: translateY(-2px); }

/* Animación de carga para botones */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
    color: transparent !important;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-top: -10px;
    margin-left: -10px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* NOTIFICATIONS SYSTEM */
.notification-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.notification-card {
    pointer-events: auto;
    width: 320px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 16px 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.5s var(--ease-out-back) forwards;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease;
    cursor: grab;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.notification-card:active {
    cursor: grabbing;
}

/* UI Elements */
.noti-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    background: rgba(0,0,0,0.05);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    color: var(--text-sec);
    opacity: 0;
    transition: opacity 0.2s, background 0.2s, transform 0.2s;
    z-index: 10;
}

.notification-card:hover .noti-close {
    opacity: 1;
}

.noti-close:hover {
    background: rgba(255, 0, 0, 0.1);
    color: #ff3b30;
    transform: scale(1.1);
}

/* Pulsing Alert for Manager */
.noti-pulse-red {
    animation: slideInRight 0.5s var(--ease-out-back) forwards,
               pulseRedBorder 2s infinite ease-in-out;
}

@keyframes pulseRedBorder {
    0% { 
        box-shadow: 0 10px 25px rgba(0,0,0,0.1), 0 0 0 0px rgba(255, 59, 48, 0); 
    }
    50% { 
        box-shadow: 0 10px 30px rgba(255, 59, 48, 0.2), 0 0 12px 2px rgba(255, 59, 48, 0.3);
        border-color: rgba(255, 59, 48, 0.6);
    }
    100% { 
        box-shadow: 0 10px 25px rgba(0,0,0,0.1), 0 0 0 0px rgba(255, 59, 48, 0); 
    }
}


.notification-card.removing {
    opacity: 0;
    transform: translateX(50px) scale(0.9);
}

.notification-icon {
    width: 36px;
    height: 36px;
    background: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.04);
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 2px;
}

.notification-text {
    font-size: 13px;
    color: var(--text-sec);
    line-height: 1.4;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@media screen and (max-width: 480px) {
    .notification-container {
        top: 16px;
        right: 16px;
        left: 16px;
    }
    .notification-card {
        width: 100%;
    }
}