/* css/style.css */
:root {
    --bg-color: #0f172a; /* Slate 900 */
    --text-color: #f8fafc; /* Slate 50 */
    --text-muted: #94a3b8; /* Slate 400 */
    --primary: #3b82f6; /* Blue 500 */
    --primary-hover: #2563eb; /* Blue 600 */
    --secondary: #1e293b; /* Slate 800 */
    --accent: #10b981; /* Emerald 500 */
    --danger: #ef4444; /* Red 500 */
    --warning: #f59e0b; /* Amber 500 */
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    /* Subtle background gradient pattern */
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
}

/* Typography */
h1, h2, h3 { font-weight: 600; }
.text-muted { color: var(--text-muted); }

/* Glassmorphism Panel */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: var(--radius-lg);
}

/* Utilities */
.hidden { display: none !important; }
.active { display: flex !important; } /* OR block, depending on context */
.full-width { width: 100%; }

/* Buttons */
button {
    cursor: pointer;
    border: none;
    outline: none;
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-icon {
    background: transparent;
    color: var(--text-color);
    font-size: 1.5rem;
    padding: 0.5rem;
    border-radius: var(--radius-full);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-sm {
    font-size: 0.875rem;
    padding: 0.4rem 0.8rem;
}

/* Inputs */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.input-group label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    font-size: 1.25rem;
}

input, select, textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: var(--transition);
}

.input-wrapper input {
    padding-left: 3rem;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

select option {
    background: var(--secondary);
    color: white;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Views Container */
.view {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    animation: fadeIn 0.4s ease;
}

/* Login specific */
#login-view {
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem 2rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-icon {
    font-size: 3.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.login-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

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

.error-msg {
    margin-top: 1rem;
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.75rem;
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 0.875rem;
}

/* App Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-radius: 0;
    border-top: none;
    border-left: none;
    border-right: none;
    z-index: 10;
    position: sticky;
    top: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon-small {
    font-size: 2rem;
    color: var(--primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.notification-bell {
    position: relative;
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0.5rem;
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.notification-bell:hover {
    background: rgba(255, 255, 255, 0.1);
}

.badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    height: 18px;
    min-width: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

@media (max-width: 480px) {
    #user-name-display { display: none; }
}

/* App Nav */
.app-nav {
    display: flex;
    padding: 1rem 1.5rem 0;
    gap: 1rem;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
}
.app-nav::-webkit-scrollbar { display: none; } /* Chrome */

.nav-btn {
    background: transparent;
    color: var(--text-muted);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
}

.nav-btn:hover {
    color: var(--text-color);
}

.nav-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: linear-gradient(to top, rgba(59, 130, 246, 0.1), transparent);
}

/* App Content */
.app-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.tab-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-panel {
    padding: 2rem;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.form-panel h3 {
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Notification Toast */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast.success i { color: var(--accent); }
.toast.error i { color: var(--danger); }

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

/* Basic Card Layout for later */
.card-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.skeleton-card {
    height: 100px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Notification Dropdown */
.notification-dropdown {
    position: absolute;
    top: 70px;
    right: 1.5rem;
    width: 300px;
    max-height: 400px;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
    transform-origin: top right;
    transition: var(--transition);
}

.notification-dropdown.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
    display: flex !important; /* Keep display flex for animation but hide via opacity */
}

.dropdown-header {
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
    font-weight: 600;
}

.dropdown-body {
    overflow-y: auto;
    flex: 1;
}

.notification-item {
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.notification-item:hover {
    background: rgba(255,255,255,0.05);
}

.notification-item.unread {
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid var(--primary);
}

.notification-item .time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Calendar Styling */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}

.calendar-day-header {
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.5rem 0;
    font-size: 0.875rem;
}

.calendar-cell {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    min-height: 100px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.calendar-cell.empty {
    background: transparent;
    border-color: transparent;
}

.calendar-date {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    color: var(--text-muted);
}

.calendar-event {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.event-ferie { background-color: var(--primary); }
.event-malattia { background-color: var(--danger); }
.event-permesso { background-color: var(--accent); }
