/* ==================== VARIABLEN ==================== */
:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --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;
    --white: #ffffff;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
}

/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    min-height: 100vh;
    color: var(--gray-900);
    line-height: 1.6;
}

/* ==================== LAYOUT ==================== */
.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 24px;
    position: relative;
}

header h1 {
    color: var(--white);
    font-size: 2rem;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    color: rgba(255,255,255,0.8);
    font-size: 1.1rem;
}

header a {
    display: inline-block;
    margin-top: 10px;
}

/* ==================== CARDS ==================== */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 20px;
}

.card h2 {
    color: var(--gray-800);
    margin-bottom: 20px;
    font-size: 1.4rem;
}

.card h3 {
    color: var(--gray-700);
    margin-bottom: 12px;
    font-size: 1.1rem;
}

/* ==================== FORMULARE ==================== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-group .hint {
    display: block;
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 4px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    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: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-success:hover {
    background: #15803d;
}

.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 1.2rem;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.9rem;
}

/* ==================== ERGEBNIS ==================== */
.result {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 2px solid var(--success);
}

.cost-breakdown {
    margin-bottom: 20px;
}

.cost-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-200);
}

.cost-item.sub {
    padding-left: 20px;
    font-size: 0.9rem;
    color: var(--gray-500);
    border-bottom: none;
    padding-top: 0;
}

.cost-label {
    color: var(--gray-600);
}

.cost-value {
    font-weight: 600;
    color: var(--gray-800);
}

.cost-total {
    display: flex;
    justify-content: space-between;
    padding: 16px 0;
    margin-top: 8px;
    border-top: 2px solid var(--success);
}

.cost-total .cost-label {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--gray-800);
}

.cost-total .cost-value {
    font-size: 1.5rem;
    color: var(--success);
}

/* ==================== INFO BOX ==================== */
.info {
    background: var(--gray-50);
}

.settings-info {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.settings-info span {
    color: var(--gray-600);
}

.settings-info strong {
    color: var(--primary);
}

/* ==================== HISTORIE ==================== */
.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--gray-50);
    border-radius: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 10px;
}

.history-header {
    display: flex;
    flex-direction: column;
    min-width: 150px;
}

.history-date {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.history-details {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.history-details span {
    color: var(--gray-600);
}

.history-price {
    font-weight: 600;
    color: var(--success) !important;
}

.empty {
    color: var(--gray-500);
    text-align: center;
    padding: 20px;
}

/* ==================== FOOTER ==================== */
footer {
    text-align: center;
    margin-top: 20px;
}

footer a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.9rem;
}

footer a:hover {
    color: var(--white);
}

/* ==================== HISTORIE MIT BILDERN ==================== */
.history-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.history-content {
    flex: 1;
    min-width: 200px;
}

.history-link {
    display: inline-block;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
    margin-left: 8px;
}

.history-link:hover {
    text-decoration: underline;
}

/* ==================== BILD UPLOAD ==================== */
.image-preview {
    max-width: 200px;
    max-height: 150px;
    margin-top: 10px;
    border-radius: 8px;
    border: 2px solid var(--gray-200);
}

input[type="file"] {
    padding: 10px;
    border: 2px dashed var(--gray-300);
    border-radius: 8px;
    background: var(--gray-50);
    cursor: pointer;
    width: 100%;
}

input[type="file"]:hover {
    border-color: var(--primary);
    background: var(--gray-100);
}

/* ==================== LOGIN OVERLAY ==================== */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.login-box {
    background: var(--white);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.login-box h2 {
    margin-bottom: 16px;
    color: var(--gray-800);
}

.login-box p {
    margin-bottom: 20px;
    color: var(--gray-600);
}

.login-box input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 16px;
}

.login-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.login-box .btn {
    width: 100%;
}

.login-box .error {
    color: var(--danger);
    margin-top: 12px;
    font-size: 0.9rem;
}

/* ==================== WARTUNGSMODUS OVERLAY ==================== */
.wartungs-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #dc2626 0%, #f59e0b 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.wartungs-box {
    background: var(--white);
    padding: 50px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 600px;
    width: 90%;
}

.wartungs-box h1 {
    margin-bottom: 20px;
    color: var(--gray-800);
    font-size: 2rem;
}

/* ==================== TOGGLE SWITCH ==================== */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle {
    position: relative;
    display: inline-block;
    min-width: 50px;
    width: 50px;
    height: 26px;
    flex-shrink: 0;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle input:checked + .toggle-slider {
    background-color: var(--success);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* ==================== ADMIN TABS ==================== */
.admin-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: var(--white);
    padding: 8px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.admin-tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: var(--gray-100);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--gray-600);
    transition: all 0.2s;
}

.admin-tab:hover {
    background: var(--gray-200);
}

.admin-tab.active {
    background: var(--primary);
    color: var(--white);
}

.admin-tab-content {
    display: none;
}

.admin-tab-content.active {
    display: block;
}

/* ==================== HISTORIE FILTER ==================== */
.history-filter {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--primary);
    color: var(--white);
    border-radius: 8px;
    margin-bottom: 16px;
}

.history-filter .btn {
    background: rgba(255,255,255,0.2);
    color: var(--white);
    border: 1px solid rgba(255,255,255,0.3);
}

.history-filter .btn:hover {
    background: rgba(255,255,255,0.3);
}

.user-filter {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
}

.user-filter:hover {
    text-decoration: underline;
}

/* ==================== EIGENE PROJEKTE ==================== */
.my-project {
    border-left: 4px solid var(--primary);
}

.project-year {
    margin-bottom: 8px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
}

.year-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: white;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.year-header:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.year-header.expanded {
    border-radius: 8px 8px 0 0;
}

.year-content {
    padding: 8px;
    background: var(--gray-50);
}

.project-month {
    margin-bottom: 4px;
    border-radius: 6px;
    overflow: hidden;
    background: white;
}

.month-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--gray-100);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.month-header:hover {
    background: var(--gray-200);
}

.month-content {
    padding: 8px;
}

.toggle-icon {
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.year-label, .month-label {
    flex: 1;
}

.year-count, .month-count {
    font-size: 0.85rem;
    opacity: 0.8;
    font-weight: normal;
}

.month-count {
    color: var(--gray-500);
}

.project-notes {
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--gray-50);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--gray-600);
}

/* ==================== WORKFLOW: WARTESCHLANGE & ERLEDIGT ==================== */
.warteschlange-item {
    border-left: 4px solid #f59e0b;
    background: linear-gradient(to right, #fffbeb 0%, white 100%);
}

.erledigt-item {
    border-left: 4px solid var(--success);
    background: linear-gradient(to right, #f0fdf4 0%, white 100%);
}

.erledigt-year .year-header {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.erledigt-year .year-header:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
}

.workflow-actions {
    display: flex;
    gap: 8px;
}

/* ==================== PREISDETAILS KLAPPBOX ==================== */
.price-details-toggle {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.price-details-toggle:hover {
    background: var(--gray-100);
    color: var(--primary-dark);
}

.price-details-box {
    display: none;
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--gray-50);
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    font-size: 0.85rem;
}

.price-details-box.open {
    display: block;
}

.price-details-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 16px;
}

.price-details-grid .label {
    color: var(--gray-600);
}

.price-details-grid .value {
    text-align: right;
    font-weight: 500;
    color: var(--gray-800);
}

.price-details-grid .divider {
    grid-column: 1 / -1;
    height: 1px;
    background: var(--gray-200);
    margin: 6px 0;
}

.price-details-grid .total {
    font-weight: 600;
    color: var(--primary);
    font-size: 1rem;
}

.price-details-grid .hint {
    font-size: 0.75rem;
    color: var(--gray-400);
    font-style: italic;
}

textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: all 0.2s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* ==================== MODALS ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    cursor: pointer;
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
}

.modal-dialog {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-dialog h2 {
    margin-bottom: 20px;
    color: var(--gray-800);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.clickable {
    cursor: pointer;
    transition: transform 0.2s;
}

.clickable:hover {
    transform: scale(1.05);
}

.history-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}
