:root {
    --primary: #3498db;
    --danger: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
    --dark: #2c3e50;
    --light: #ecf0f1;
    --sidebar-width: 250px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f6fa;
    color: var(--dark);
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--dark);
    color: white;
    position: fixed;
    height: 100vh;
    padding: 20px 0;
}

.logo {
    padding: 0 20px 30px;
    font-size: 1.5rem;
    font-weight: bold;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 20px;
}

.logo i {
    color: var(--danger);
    margin-right: 10px;
}

.nav-menu {
    list-style: none;
}

.nav-menu li {
    padding: 15px 25px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-menu li:hover,
.nav-menu li.active {
    background: rgba(255,255,255,0.1);
    border-left: 4px solid var(--primary);
}

.nav-menu i {
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 30px;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.view-header h1 {
    font-size: 2rem;
    color: var(--dark);
}

/* Calendar */
.calendar-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.calendar-nav button {
    background: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.calendar-nav button:hover {
    background: var(--primary);
    color: white;
}

.calendar-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

.calendar-header {
    text-align: center;
    font-weight: bold;
    padding: 10px;
    color: var(--dark);
}

.calendar-day {
    min-height: 100px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.calendar-day:hover {
    background: #f8f9fa;
    border-color: var(--primary);
}

.calendar-day.other-month {
    color: #bbb;
    background: #f8f9fa;
}

.calendar-day-number {
    font-weight: bold;
    margin-bottom: 5px;
}

.calendar-day.today {
    background: #e3f2fd;
    border-color: var(--primary);
}

.calendar-day.today .calendar-day-number {
    color: var(--primary);
}

.event-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin: 1px;
}

.event-indicator {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-top: 5px;
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.card h3 {
    margin-bottom: 15px;
    color: var(--dark);
    font-size: 1.1rem;
}

.stats-card {
    text-align: center;
}

.stat-number {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary);
}

.chart-card {
    grid-column: span 2;
}

.chart-card canvas {
    max-height: 250px;
}

.list-card {
    grid-column: span 2;
}

.list-card ul {
    list-style: none;
}

.list-card li {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Correlations */
.correlation-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.correlation-controls input {
    width: 60px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.correlations-container {
    display: grid;
    gap: 15px;
}

.correlation-item {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.correlation-trigger {
    display: flex;
    align-items: center;
    gap: 15px;
}

.correlation-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.correlation-info h4 {
    margin-bottom: 5px;
}

.correlation-stats {
    display: flex;
    gap: 20px;
    text-align: center;
}

.stat-box {
    padding: 10px 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-box .value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--danger);
}

.stat-box .label {
    font-size: 0.8rem;
    color: #666;
}

/* History */
#search-events {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    width: 300px;
}

.history-list {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.history-item {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.3s;
}

.history-item:hover {
    background: #f8f9fa;
}

.history-item:last-child {
    border-bottom: none;
}

.history-meta {
    display: flex;
    align-items: center;
    gap: 15px;
}

.history-type {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: white;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    cursor: pointer;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.form-group input[type="range"] {
    width: calc(100% - 40px);
    display: inline-block;
}

#severity-value {
    display: inline-block;
    width: 30px;
    text-align: center;
    font-weight: bold;
    color: var(--danger);
}

.form-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 25px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: var(--light);
    color: var(--dark);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    
    .logo span,
    .nav-menu span {
        display: none;
    }
    
    .main-content {
        margin-left: 60px;
        padding: 15px;
    }
    
    .calendar-day {
        min-height: 60px;
        font-size: 0.85rem;
    }
    
    .chart-card,
    .list-card {
        grid-column: span 1;
    }
    
    .correlation-item {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}