/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-main: #f9fafb;
    --bg-card: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
}

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

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 2rem 1rem;
    box-shadow: var(--shadow-lg);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.subtitle {
    opacity: 0.9;
    font-size: 1.1rem;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 1rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

section {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* Dashboard Stats */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-main);
    border-radius: 12px;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.success-rate .stat-value {
    color: var(--success);
}

/* Priority Breakdown */
.priority-breakdown {
    display: grid;
    gap: 1rem;
}

.priority-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-main);
    border-radius: 8px;
    transition: background 0.2s;
}

.priority-item:hover {
    background: #f3f4f6;
}

.priority-label {
    font-weight: 600;
    min-width: 100px;
}

.priority-bar-container {
    flex: 1;
    height: 30px;
    background: #e5e7eb;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.priority-bar {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.75rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: white;
    transition: width 0.5s ease;
}

.priority-stats {
    min-width: 120px;
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.p1 { background: #ef4444; }
.p2 { background: #f59e0b; }
.p3 { background: #eab308; }
.p4 { background: #3b82f6; }
.p5 { background: #8b5cf6; }

/* Activity Type Distribution */
.type-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.type-item {
    padding: 1.5rem;
    background: var(--bg-main);
    border-radius: 8px;
    text-align: center;
    transition: transform 0.2s;
}

.type-item:hover {
    transform: translateY(-2px);
}

.type-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.type-name {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.type-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.type-percentage {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

.calendar-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-nav {
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-nav:hover {
    background: var(--primary-dark);
}

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

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

.calendar-day {
    aspect-ratio: 1;
    padding: 0.5rem;
    background: var(--bg-main);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.calendar-day:hover {
    background: #f3f4f6;
    transform: scale(1.05);
}

.calendar-day.selected {
    background: var(--primary);
    color: white;
}

.calendar-day.empty {
    opacity: 0.3;
}

.day-number {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.day-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.calendar-day.selected .day-count {
    color: rgba(255, 255, 255, 0.8);
}

.day-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
}

/* Daily Schedule */
.daily-schedule {
    display: grid;
    gap: 0.75rem;
}

.placeholder {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.schedule-item {
    padding: 1rem;
    background: var(--bg-main);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    transition: all 0.2s;
}

.schedule-item:hover {
    background: #f3f4f6;
    transform: translateX(4px);
}

.schedule-time {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.schedule-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.schedule-details {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.schedule-badge {
    padding: 0.25rem 0.75rem;
    background: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Failures */
.failures-list {
    display: grid;
    gap: 0.75rem;
}

.failure-item {
    padding: 1rem;
    background: #fef2f2;
    border-left: 4px solid var(--danger);
    border-radius: 8px;
}

.failure-name {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.failure-reason {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .stat-cards {
        grid-template-columns: 1fr;
    }

    .calendar-grid {
        gap: 0.25rem;
    }

    .calendar-day {
        padding: 0.25rem;
    }

    .day-number {
        font-size: 0.875rem;
    }
}
