/* CSS Variables */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #10b981;
    --success-dark: #059669;
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius: 12px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    min-height: 100vh;
    line-height: 1.5;
}

/* Navbar */
.navbar { color: white;
    background: #475569;
    box-shadow: var(--shadow);
    padding: 0 1rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    font-weight: 700;
    font-size: 1.25rem;
    color: white;
    text-decoration: none;
}

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

.nav-link {
    padding: 0.5rem 1rem;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

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

.nav-user {
    position: relative;
}

.user-name {
    padding: 0.5rem 1rem;
    background: var(--gray-100);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}

.user-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    display: none;
    overflow: hidden;
}

.nav-user:hover .user-menu {
    display: block;
}

.user-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--gray-700);
    text-decoration: none;
    transition: background 0.2s;
}

.user-menu a:hover {
    background: var(--gray-100);
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-error {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
}

.alert-success {
    background: #ecfdf5;
    color: var(--success-dark);
    border: 1px solid #a7f3d0;
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.5;
}

/* Login */
.login-container {
    min-height: calc(100vh - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
}

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

.login-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--gray-500);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="date"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

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

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 150px;
}

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

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

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

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

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

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

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

.btn-small {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.btn-full {
    width: 100%;
}

/* Clock Container */
.clock-container {
    text-align: center;
    padding: 1rem 0;
}

.time-display {
    margin-bottom: 2rem;
}

.current-time {
    font-size: 3.5rem;
    font-weight: 700;
    color: white;
    letter-spacing: -2px;
}

.current-date {
    font-size: 1.1rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* Status Card */
.status-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.status-card.clocked-in {
    border-left: 4px solid var(--success);
}

.status-card.clocked-out {
    border-left: 4px solid var(--gray-300);
}

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

.status-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
}

.active-duration {
    margin-top: 0.5rem;
    color: var(--gray-500);
}

#runningTime {
    font-family: monospace;
    font-size: 1.1rem;
    color: var(--success);
}

/* Slider */
.slider-container {
    margin: 2rem 0;
    padding: 0 1rem;
}

.slider-track {
    position: relative;
    height: 70px;
    background: linear-gradient(135deg, var(--gray-200) 0%, var(--gray-100) 100%);
    border-radius: 35px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.slider-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 60px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 35px;
    transition: width 0.3s ease;
}

.clocked-in .slider-fill {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
}

.slider-thumb {
    position: absolute;
    left: 5px;
    top: 5px;
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    cursor: grab;
    transition: transform 0.3s ease;
    z-index: 2;
    user-select: none;
    -webkit-user-select: none;
}

.slider-thumb:active {
    cursor: grabbing;
}

.thumb-icon {
    font-size: 1.5rem;
    color: var(--primary);
}

.clocked-in .thumb-icon {
    color: var(--success);
}

.slider-text {
    position: absolute;
    left: 80px;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 600;
    color: var(--gray-500);
    transition: opacity 0.2s;
    pointer-events: none;
}

/* Today Summary */
.today-summary {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.today-summary h3 {
    margin-bottom: 1rem;
    color: var(--gray-700);
}

.summary-stats {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.stat {
    text-align: center;
}

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

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.today-entries {
    border-top: 1px solid var(--gray-200);
    padding-top: 1rem;
    margin-top: 1rem;
}

.entry-row {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 0.5rem;
    color: rgba(255,255,255,0.85);
}

.entry-separator {
    color: var(--gray-400);
}

/* History */
.history-container h1 {
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.day-card {
    background: white;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow);
}

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

.day-date {
    font-weight: 600;
    color: white;
}

.day-total {
    font-weight: 700;
    color: var(--primary);
}

.entry-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    color: rgba(255,255,255,0.85);
}

.time-separator {
    margin: 0 0.5rem;
    color: var(--gray-400);
}

.entry-duration {
    color: var(--gray-500);
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray-500);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Admin */
.admin-container {
    max-width: 900px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.admin-header h1 {
    margin: 0;
}

.card {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.card h2 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--gray-700);
}

.user-form {
    margin-bottom: 0;
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.user-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 1rem;
}

.user-card.inactive {
    opacity: 0.6;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gray-300);
}

.user-status-dot.online {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-fullname {
    color: var(--gray-800);
    font-weight: 600;
}

.user-username {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

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

.badge-inactive {
    background: var(--gray-400);
    color: white;
}

.user-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Reports */
.date-filter-form .form-row {
    align-items: flex-end;
}

.report-table-container {
    overflow-x: auto;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
}

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

.report-table th {
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    background: var(--gray-50);
}

.hours-badge {
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.875rem;
}

/* Settings */
.settings-container {
    max-width: 500px;
    margin: 0 auto;
}

.password-form .form-group {
    margin-bottom: 1.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Responsive */
@media (max-width: 600px) {
    .navbar { color: white;
        padding: 0 0.75rem;
    }
    
    .nav-links {
        display: none;
    }
    
    .container {
        padding: 1rem;
    }
    
    .current-time {
        font-size: 2.5rem;
    }
    
    .slider-text {
        font-size: 0.875rem;
    }
    
    .user-card {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .user-actions {
        width: 100%;
    }
    
    .user-actions .btn {
        flex: 1;
    }
}

/* Extended Admin Styles */
.admin-container.wide { max-width: 1200px; }
.header-buttons { display: flex; gap: 0.5rem; }
.form-section { margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--gray-200); }
.form-section h3 { font-size: 1rem; color: rgba(255,255,255,0.85); margin-bottom: 1rem; }
.user-funktion { font-size: 0.8rem; color: var(--gray-500); display: block; }
.user-wage-info { margin-left: auto; padding-left: 1rem; }
.wage-badge { background: var(--gray-200); color: var(--gray-700); padding: 0.25rem 0.5rem; border-radius: 4px; font-size: 0.8rem; }
.help-text { color: var(--gray-500); margin-bottom: 1.5rem; }
.time-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; margin-bottom: 1.5rem; }
.time-setting-group { background: var(--gray-50); padding: 1rem; border-radius: 8px; }
.time-setting-group h3 { margin-bottom: 1rem; font-size: 1rem; }
.holiday-form { margin-bottom: 1.5rem; }
.holiday-form .form-row { align-items: flex-end; }
.holidays-list { margin-top: 1rem; }
.simple-table { width: 100%; border-collapse: collapse; }
.simple-table th, .simple-table td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--gray-200); }
.simple-table th { font-weight: 600; color: rgba(255,255,255,0.85); }
.empty-text { color: var(--gray-500); font-style: italic; }
.text-muted { color: var(--gray-500); }
.total-badge { background: var(--success); color: white; padding: 0.25rem 0.75rem; border-radius: 20px; font-weight: 600; font-size: 0.875rem; }
.total-badge.large { font-size: 1rem; padding: 0.5rem 1rem; }
.totals-row { background: var(--gray-50); font-weight: 600; }
.settings-form { margin-bottom: 0; }

/* Select styling */
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}
select:focus {
    outline: none;
    border-color: var(--primary);
}
.filter-form .form-row {
    align-items: flex-end;
}
.entries-table-container {
    overflow-x: auto;
}

/* Betriebe Styles */
.betriebe-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.betrieb-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 1rem;
}
.betrieb-card.inactive {
    opacity: 0.6;
}
.betrieb-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.betrieb-name {
    color: var(--gray-800);
    font-weight: 600;
}
.betrieb-adresse {
    font-size: 0.875rem;
    color: var(--gray-500);
}
.betrieb-actions {
    display: flex;
    gap: 0.5rem;
}
.betrieb-selection {
    margin-bottom: 1.5rem;
    padding: 1rem;
}
.betrieb-selection label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}
.betrieb-selection select {
    width: 100%;
}
