:root {
    --primary: #2c5282;
    --primary-light: #4299e1;
    --secondary: #718096;
    --success: #48bb78;
    --danger: #f56565;
    --warning: #ed8936;
    --background: #f7fafc;
    --surface: #ffffff;
    --text: #2d3748;
    --text-light: #718096;
    --border: #e2e8f0;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* Layout */
.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    background: var(--primary);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.app-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1rem;
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
}

.app-nav a {
    padding: 0.5rem 1rem;
    color: var(--text);
    text-decoration: none;
    border-radius: var(--radius);
    white-space: nowrap;
    transition: background 0.2s;
}

.app-nav a:hover {
    background: var(--background);
}

.app-nav a.active {
    background: var(--primary);
    color: white;
}

.app-main {
    flex: 1;
    padding: 1rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

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

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

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

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--background);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
}

/* Calendar */
.calendar {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--primary);
    color: white;
}

.calendar-nav {
    display: flex;
    gap: 0.5rem;
}

.calendar-nav button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
}

.calendar-nav button:hover {
    background: rgba(255,255,255,0.3);
}

.calendar-title {
    font-weight: 600;
}

.calendar-toggle {
    display: flex;
    gap: 0.25rem;
    background: rgba(255,255,255,0.2);
    border-radius: var(--radius);
    padding: 0.25rem;
}

.calendar-toggle button {
    padding: 0.25rem 0.75rem;
    border: none;
    background: transparent;
    color: white;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
}

.calendar-toggle button.active {
    background: white;
    color: var(--primary);
}

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

.calendar-weekday {
    padding: 0.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-light);
    background: var(--background);
}

.calendar-day {
    min-height: 80px;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-top: none;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}

.calendar-day:hover {
    background: var(--background);
}

.calendar-day.other-month {
    background: #f8f9fa;
    color: var(--text-light);
}

.calendar-day.today {
    background: #ebf8ff;
}

.calendar-day-number {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.calendar-day.has-birthday .calendar-day-number::after {
    content: ' 🎂';
}

.calendar-entries {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.calendar-entry {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 0.7rem;
    color: white;
    cursor: pointer;
}

.calendar-entry.ferien {
    background: repeating-linear-gradient(
        45deg,
        var(--entry-color),
        var(--entry-color) 4px,
        transparent 4px,
        transparent 8px
    );
    border: 1px solid var(--entry-color);
    color: var(--text);
}

.calendar-entry .entry-avatar {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.calendar-entry .entry-type {
    font-size: 0.6rem;
    opacity: 0.9;
}

/* Week View */
.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.week-day {
    border: 1px solid var(--border);
}

.week-day-header {
    padding: 0.5rem;
    text-align: center;
    background: var(--background);
    font-size: 0.75rem;
    font-weight: 600;
}

.week-slot {
    min-height: 60px;
    padding: 0.5rem;
    border-top: 1px solid var(--border);
    cursor: pointer;
}

.week-slot:hover {
    background: var(--background);
}

.week-slot-label {
    font-size: 0.6rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

/* Entry Dialog */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.dialog {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    max-width: 400px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.dialog-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dialog-title {
    font-weight: 600;
}

.dialog-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
}

.dialog-body {
    padding: 1rem;
}

.dialog-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Avatar */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    font-size: 1rem;
}

.avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Profile Colors */
.color-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.2s;
    position: relative;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: var(--text);
}

.color-option.taken {
    opacity: 0.3;
    cursor: not-allowed;
}

.color-option.taken::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
}

/* Time Tracking */
.time-table {
    width: 100%;
    border-collapse: collapse;
}

.time-table th,
.time-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.time-table th {
    background: var(--background);
    font-weight: 600;
    font-size: 0.875rem;
}

.time-table input {
    width: 80px;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    text-align: center;
}

.time-table .total-row {
    font-weight: 600;
    background: var(--background);
}

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.auth-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo h1 {
    color: var(--primary);
    font-size: 1.5rem;
}

.auth-logo p {
    color: var(--text-light);
    font-size: 0.875rem;
}

.auth-links {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.875rem;
}

.auth-links a {
    color: var(--primary);
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-success {
    background: #c6f6d5;
    color: #276749;
}

.alert-danger {
    background: #fed7d7;
    color: #c53030;
}

.alert-warning {
    background: #feebc8;
    color: #c05621;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

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

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

/* Hidden */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .calendar-day {
        min-height: 60px;
        padding: 0.25rem;
    }

    .calendar-day-number {
        font-size: 0.75rem;
    }

    .calendar-entry {
        font-size: 0.6rem;
        padding: 1px 2px;
    }

    .calendar-entry .entry-avatar {
        width: 14px;
        height: 14px;
        font-size: 0.5rem;
    }

    .app-nav {
        justify-content: flex-start;
    }

    .time-table {
        font-size: 0.875rem;
    }

    .time-table input {
        width: 60px;
    }
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius);
}

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

.user-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 180px;
    z-index: 101;
}

.user-menu-dropdown a,
.user-menu-dropdown button {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    text-align: left;
    color: var(--text);
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.875rem;
}

.user-menu-dropdown a:hover,
.user-menu-dropdown button:hover {
    background: var(--background);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.tab-btn {
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-light);
    transition: all 0.2s;
}

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

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Entry List */
.entry-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.entry-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--background);
    border-radius: var(--radius);
}

.entry-item-info {
    display: flex;
    flex-direction: column;
}

.entry-item-date {
    font-weight: 500;
}

.entry-item-type {
    font-size: 0.75rem;
    color: var(--text-light);
}

.entry-item-actions {
    display: flex;
    gap: 0.25rem;
}
