/* ============================================
   WORKTIME - COMPLETE STYLESHEET
   Zeitabrechnung & Fallbearbeitung
   ============================================ */

/* ============================================
   CSS VARIABLES (FARBEN & EINSTELLUNGEN)
   ============================================ */
:root {
    /* Hauptfarben */
    --primary: #5c7cfa;
    --primary-dark: #4263eb;
    --primary-light: #e7f5ff;
    
    /* Status Farben */
    --success: #40c057;
    --success-light: #d3f9d8;
    --warning: #fcc419;
    --warning-light: #fff3bf;
    --danger: #fa5252;
    --danger-light: #ffe3e3;
    --info: #339af0;
    --info-light: #e7f5ff;
    
    /* Text Farben */
    --text-main: #212529;
    --text-light: #868e96;
    --text-muted: #adb5bd;
    
    /* UI Farben */
    --bg-body: #f8f9fa;
    --bg-card: #ffffff;
    --bg-sidebar: #1a1a2e;
    --border: #e1e4e8;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.15);
    
    /* Grössen */
    --sidebar-width: 260px;
    --header-height: 70px;
    --radius: 8px;
    --radius-lg: 12px;
}

/* ============================================
   GLOBAL RESET & BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    color: white;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h1 {
    font-size: 1.4em;
    font-weight: 700;
    margin-bottom: 5px;
}

.sidebar-header p {
    font-size: 0.85em;
    color: rgba(255,255,255,0.7);
}

.sidebar-stats {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-stats h3 {
    font-size: 0.9em;
    color: rgba(255,255,255,0.7);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

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

.stat-item .label {
    font-size: 0.85em;
    color: rgba(255,255,255,0.7);
}

.stat-item .value {
    font-weight: 600;
    font-size: 0.95em;
}

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

.stat-item .value.negative {
    color: var(--danger);
}

.nav-menu {
    flex: 1;
    padding: 15px 0;
}

.nav-menu li {
    margin: 2px 10px;
}

.nav-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-radius: var(--radius);
    color: rgba(255,255,255,0.8);
    font-size: 0.95em;
    transition: all 0.2s ease;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-menu a i {
    width: 20px;
    text-align: center;
    font-size: 1.1em;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer .btn {
    margin-bottom: 10px;
}

.sidebar-footer .btn:last-child {
    margin-bottom: 0;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 30px;
    min-height: 100vh;
}

/* ============================================
   MONTH HEADER
   ============================================ */
.month-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.month-header h2 {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 5px;
}

.month-header p {
    color: var(--text-light);
    font-size: 0.95em;
}

.month-selector {
    display: flex;
    gap: 10px;
    align-items: center;
}

.month-selector select {
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    background: white;
    cursor: pointer;
    min-width: 130px;
}

.month-selector select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ============================================
   CONTENT CARDS
   ============================================ */
.content-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.content-card h3 {
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.content-card h3 i {
    color: var(--primary);
}

/* ============================================
   QUICK STATS CARDS
   ============================================ */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.quick-stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.quick-stat-card .label {
    font-size: 0.85em;
    color: var(--text-light);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quick-stat-card .value {
    font-size: 2em;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 5px;
}

.quick-stat-card .sub {
    font-size: 0.85em;
    color: var(--text-light);
}

.quick-stat-card .sub .positive {
    color: var(--success);
    font-weight: 600;
}

.quick-stat-card .sub .negative {
    color: var(--danger);
    font-weight: 600;
}

.quick-stat-card.success {
    border-left: 4px solid var(--success);
}

.quick-stat-card.warning {
    border-left: 4px solid var(--warning);
}

.quick-stat-card.danger {
    border-left: 4px solid var(--danger);
}

/* ============================================
   ENTRY FORM CARD
   ============================================ */
.entry-form-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.entry-form-card h3 {
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.entry-form-card h3 i {
    color: var(--success);
}

.form-row-single {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    align-items: end;
}

.form-field {
    display: flex;
    flex-direction: column;
}

.form-field label {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-field label i {
    color: var(--primary);
    width: 16px;
}

.form-field input,
.form-field select,
.form-field textarea {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    background: white;
    transition: all 0.2s ease;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-field input[type="date"],
.form-field input[type="time"],
.form-field input[type="number"] {
    min-width: 140px;
}

.form-field-button {
    display: flex;
    align-items: flex-end;
}

.form-field-button button {
    width: 100%;
    padding: 10px 20px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    justify-content: center;
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(92, 124, 250, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn i {
    font-size: 1em;
}

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

.btn-success:hover {
    background: #37b24d;
    box-shadow: 0 4px 12px rgba(64, 192, 87, 0.3);
}

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

.btn-danger:hover {
    background: #e03131;
    box-shadow: 0 4px 12px rgba(250, 82, 82, 0.3);
}

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

.btn-secondary:hover {
    background: #495057;
    box-shadow: 0 4px 12px rgba(134, 142, 150, 0.3);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* ============================================
   TABLES
   ============================================ */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

table thead {
    background: #f8f9fa;
}

table th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85em;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

table td {
    padding: 15px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.95em;
    vertical-align: middle;
}

table tbody tr {
    transition: background 0.2s ease;
}

table tbody tr:hover {
    background: var(--primary-light);
}

table tbody tr.highlight {
    background: var(--warning-light);
}

table tbody tr:last-child td {
    border-bottom: none;
}

table .total-row {
    background: #f8f9fa;
    font-weight: 600;
}

table .total-row td {
    border-top: 2px solid var(--border);
    padding-top: 18px;
}

.clean-table {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.clean-table thead {
    background: var(--primary);
}

.clean-table th {
    color: white;
    border-bottom: none;
}

.clean-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.clean-table tbody tr:hover {
    background: var(--primary-light);
}

/* ============================================
   TEXT COLORS & UTILITIES
   ============================================ */
.positive {
    color: var(--success);
    font-weight: 600;
}

.negative {
    color: var(--danger);
    font-weight: 600;
}

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

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-muted);
}

.text-small {
    font-size: 0.85em;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state .icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 1.1em;
    margin-bottom: 10px;
}

.empty-state p:last-child {
    font-size: 0.9em;
}

/* ============================================
   CALENDAR STYLES
   ============================================ */
.calendar-container {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}

.calendar-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.calendar-nav {
    display: flex;
    gap: 10px;
    align-items: center;
}

.calendar-nav a,
.calendar-nav select {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
}

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

.calendar-nav select {
    padding: 6px 10px;
    min-width: 100px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e1e4e8;
    border: 1px solid #e1e4e8;
}

.calendar-day-header {
    background: #f8f9fa;
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.9em;
}

.calendar-day {
    background: white;
    min-height: 120px;
    padding: 8px;
    position: relative;
}

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

.calendar-day.today {
    background: #e7f5ff;
    border: 2px solid var(--primary);
}

.calendar-day-number {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 1.1em;
}

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

.calendar-event {
    display: block;
    background: #f8f9fa;
    padding: 5px 8px;
    border-radius: 4px;
    margin-bottom: 5px;
    font-size: 0.8em;
    border-left: 3px solid var(--primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
}

.calendar-event:hover {
    background: var(--primary-light);
    transform: translateX(3px);
}

.calendar-event.due {
    border-left-color: var(--danger);
    background: var(--danger-light);
}

.calendar-event.incident {
    border-left-color: var(--success);
    background: var(--success-light);
}

.calendar-event.appointment {
    border-left-width: 4px;
    padding: 6px 8px;
}

.calendar-event-time {
    font-weight: 600;
    font-size: 0.75em;
    opacity: 0.9;
    margin-bottom: 2px;
}

.calendar-event-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    margin-top: 2px;
}

.calendar-event-case {
    color: var(--text-light);
    font-size: 0.85em;
    margin-top: 2px;
}

.calendar-event-location {
    font-size: 0.7em;
    color: var(--text-light);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.calendar-event-location i {
    font-size: 0.8em;
}

.calendar-legend {
    display: flex;
    gap: 20px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: var(--text-main);
}

.legend-color {
    width: 15px;
    height: 15px;
    border-radius: 3px;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

/* ============================================
   APPOINTMENT FORM STYLES
   ============================================ */
.form-container {
    max-width: 700px;
    margin: 40px auto;
    background: white;
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.form-container h3 {
    font-size: 1.5em;
    font-weight: 600;
    margin-bottom: 25px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
}

.form-row-full {
    margin-bottom: 15px;
}

.form-container label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.9em;
    color: var(--text-main);
}

.form-container input,
.form-container select,
.form-container textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.form-container input:focus,
.form-container select:focus,
.form-container textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-container input[type="color"] {
    height: 40px;
    padding: 5px;
    cursor: pointer;
    width: 60px;
}

.form-container textarea {
    min-height: 80px;
    resize: vertical;
}

.case-link {
    background: var(--primary-light);
    padding: 15px;
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
    margin-bottom: 20px;
}

.case-link label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin: 0 !important;
}

.case-link input[type="checkbox"] {
    width: auto;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.color-preview {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    vertical-align: middle;
    margin-right: 8px;
    border: 1px solid #ddd;
}

.error-box {
    background: var(--danger-light);
    color: var(--danger);
    padding: 12px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    border-left: 4px solid var(--danger);
}

.success-box {
    background: var(--success-light);
    color: var(--success);
    padding: 12px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    border-left: 4px solid var(--success);
}

/* ============================================
   LOGIN PAGE STYLES
   ============================================ */
.login-box {
    max-width: 420px;
    margin: 80px auto;
}

.login-box .card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.login-box h2 {
    text-align: center;
    margin-bottom: 25px;
    color: var(--text-main);
}

.login-box label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-light);
    font-size: 0.9em;
}

.login-box input {
    width: 100%;
    padding: 12px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

.login-box button {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.login-box button:hover {
    background: var(--accent-hover);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1024px) {
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .month-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .quick-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .main-content {
        margin-left: 0;
        padding: 15px;
    }
    
    .month-header h2 {
        font-size: 1.4em;
    }
    
    .quick-stats {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .form-row-single {
        grid-template-columns: 1fr;
    }
    
    .calendar-day {
        min-height: 80px;
        padding: 5px;
    }
    
    .calendar-event {
        font-size: 0.7em;
        padding: 3px 5px;
    }
    
    .calendar-day-header {
        padding: 10px 5px;
        font-size: 0.8em;
    }
    
    .calendar-legend {
        gap: 15px;
    }
    
    .legend-item {
        font-size: 0.8em;
    }
    
    .form-container {
        margin: 20px;
        padding: 20px;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        width: 100%;
        text-align: center;
    }
    
    table {
        font-size: 0.85em;
    }
    
    table th,
    table td {
        padding: 10px 8px;
    }
}

@media (max-width: 480px) {
    .month-selector {
        flex-direction: column;
        width: 100%;
    }
    
    .month-selector select,
    .month-selector .btn {
        width: 100%;
    }
    
    .quick-stat-card .value {
        font-size: 1.5em;
    }
    
    .calendar-grid {
        font-size: 0.8em;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .sidebar,
    .month-selector,
    .btn,
    .entry-form-card {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
        padding: 0;
    }
    
    .content-card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    table {
        page-break-inside: auto;
    }
    
    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

.sidebar ::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
}

.sidebar ::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

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

.content-card,
.quick-stat-card,
.entry-form-card {
    animation: fadeIn 0.3s ease;
}

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

.loading {
    animation: pulse 1.5s ease infinite;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }
.p-10 { padding: 10px; }
.p-20 { padding: 20px; }
.p-30 { padding: 30px; }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.hidden { display: none; }
.visible { display: block; }

/* ============================================
   END OF STYLESHEET
   ============================================ */