/**
 * Zeiterfassung - Responsive CSS
 * Optimiert für Smartphone, Tablet und Desktop
 */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 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);
}

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

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

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

.main-nav a {
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: 0.375rem;
    transition: all 0.2s;
    font-weight: 500;
}

.main-nav a:hover {
    background-color: var(--background);
    color: var(--primary-color);
}

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

/* Main Content */
.main-content {
    flex: 1;
    padding: 1.5rem;
}

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

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

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

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

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

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

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 1rem;
    background-color: var(--surface);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    min-height: 44px;
    min-width: 120px;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    text-align: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

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

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

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

.btn-success:hover {
    background-color: #059669;
}

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

.btn-danger:hover {
    background-color: #dc2626;
}

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

.btn-secondary:hover {
    background-color: #475569;
}

/* Button-Größen für verschiedene Kontexte */
.btn-small {
    padding: 0.5rem 1rem;
    min-height: 36px;
    min-width: 80px;
    font-size: 0.875rem;
}

.btn-large {
    padding: 1rem 2rem;
    min-height: 52px;
    min-width: 160px;
    font-size: 1.125rem;
}

/* Touch-optimierte Buttons */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 48px;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
        touch-action: manipulation;
    }
    
    input[type="time"],
    input[type="date"],
    input[type="text"],
    input[type="number"],
    select,
    textarea {
        min-height: 48px;
        font-size: 16px; /* Verhindert Zoom auf iOS */
        touch-action: manipulation;
    }
    
    .form-control,
    .form-select {
        min-height: 48px;
        padding: 0.875rem;
    }
    
    .calendar-day {
        min-height: 60px;
        padding: 0.5rem;
    }
    
    .main-nav a {
        min-height: 44px;
        padding: 0.75rem 1rem;
    }
}

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

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

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

.table th {
    background-color: var(--background);
    font-weight: 600;
    color: var(--text-primary);
    position: sticky;
    top: 0;
}

.table tbody tr:hover {
    background-color: var(--background);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Grid */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Utilities */
.text-center {
    text-align: center;
}

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

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

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

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

/* Footer */
.footer {
    background: var(--surface);
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

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

.calendar-day {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    text-align: center;
    min-height: 80px;
    background: var(--surface);
}

.calendar-day.weekend {
    background-color: #f1f5f9;
    color: var(--text-secondary);
}

.calendar-day.feiertag {
    background-color: #fee2e2;
    color: #991b1b;
    font-weight: 600;
}

.calendar-day.landesweiter-feiertag {
    background-color: #fef3c7;
    color: #92400e;
    border: 2px solid var(--warning-color);
}

.calendar-day.today {
    border: 2px solid var(--primary-color);
    font-weight: 600;
}

.calendar-day-header {
    font-weight: 600;
    padding: 0.5rem;
    text-align: center;
    background-color: var(--background);
    border-radius: 0.375rem;
}

/* Responsive Breakpoints */

/* Smartphone (bis 640px) */
@media (max-width: 640px) {
    .header h1 {
        font-size: 1.25rem;
    }

    .main-nav {
        flex-direction: column;
    }

    .main-nav a {
        width: 100%;
        text-align: center;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .main-content {
        padding: 1rem;
    }

    .card {
        padding: 1rem;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    /* Dashboard Quick-Zeiterfassung Mobile */
    #quickZeiterfassung form > div[style*="grid-template-columns"],
    .mobile-grid-single {
        grid-template-columns: 1fr !important;
    }
    
    input[type="time"],
    input[type="date"],
    input[type="text"],
    input[type="number"],
    select,
    textarea {
        min-height: 48px;
        font-size: 16px !important; /* Verhindert Zoom auf iOS */
        padding: 0.875rem !important;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }
    
    select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 0.75rem center;
        padding-right: 2.5rem;
    }

    .table {
        font-size: 0.875rem;
    }

    .table th,
    .table td {
        padding: 0.5rem;
    }

    .calendar {
        gap: 0.25rem;
    }

    .calendar-day {
        padding: 0.5rem;
        min-height: 60px;
        font-size: 0.875rem;
    }

    .btn {
        width: 100%;
        min-width: 100%;
        margin-bottom: 0.5rem;
        padding: 0.875rem 1.25rem;
        min-height: 48px;
        font-size: 1rem;
    }

    .d-flex {
        flex-direction: column;
    }
}

/* Tablet (641px - 1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .calendar-day {
        min-height: 70px;
    }
}

/* Desktop (ab 1025px) */
@media (min-width: 1025px) {
    .header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1.5rem 2rem;
    }

    .header h1 {
        margin-bottom: 0;
    }

    .main-content {
        padding: 2rem;
    }

    .card {
        padding: 2rem;
    }
}

/* Submenu Styles */
.submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 1000;
    min-width: 150px;
    margin-top: 0.25rem;
}

.submenu-item {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.submenu-item:hover {
    background-color: var(--background);
}

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

.submenu-item.active {
    background-color: var(--primary-color);
    color: white;
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .main-nav,
    .btn,
    .no-print {
        display: none !important;
    }

    .main-content {
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
}
