/* ReNew Color Book - 3 Seiten Layout */

/* CSS Variables */
:root {
    --renew-bg-dark: #1a1a1a;
    --renew-bg-darker: #0d0d0d;
    --renew-bg-card: #2a2a2a;
    --renew-text-white: #ffffff;
    --renew-text-light: #e0e0e0;
    --renew-text-muted: #888888;
    --renew-gold: #d4af37;
    --renew-gold-light: #e8c252;
    --renew-gold-dark: #b8942e;
    --renew-danger: #dc3545;
    --renew-success: #28a745;
    --renew-border: #3a3a3a;
    --renew-input-bg: #333333;
    --renew-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    /* Safe Area für iPhone Notch */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);
}

/* ==================== APP CONTAINER ==================== */
.renew-app {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif !important;
    background: var(--renew-bg-dark) !important;
    color: var(--renew-text-white) !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    overflow: hidden !important;
    z-index: 99999 !important;
    /* PWA Safe Area */
    padding-top: var(--safe-area-top) !important;
    padding-bottom: var(--safe-area-bottom) !important;
    padding-left: var(--safe-area-left) !important;
    padding-right: var(--safe-area-right) !important;
}

.renew-app * {
    box-sizing: border-box !important;
}

/* PWA Standalone Mode */
@media all and (display-mode: standalone) {
    .renew-app {
        /* Extra padding im Standalone-Modus */
    }
    
    .renew-pwa-install-banner {
        display: none !important;
    }
}

/* PWA Install Banner */
.renew-pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--renew-bg-card);
    border-top: 1px solid var(--renew-gold);
    padding: 12px 15px;
    padding-bottom: calc(12px + var(--safe-area-bottom));
    z-index: 100002;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}

.renew-pwa-install-content {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
}

.renew-pwa-install-content span {
    flex: 1;
    font-size: 14px;
    color: var(--renew-text-light);
}

.renew-btn-pwa-install {
    background: var(--renew-gold);
    color: var(--renew-bg-darker);
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.renew-btn-pwa-close {
    background: none;
    border: none;
    color: var(--renew-text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0 5px;
}

/* ==================== SEITEN (3 fixe Vollbild-Seiten) ==================== */
#renew-colorbook-app .renew-page {
    display: none !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: #1a1a1a !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

#renew-colorbook-app .renew-page.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.renew-page-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    overflow: hidden;
}

.renew-page-content.renew-center {
    justify-content: center;
    align-items: center;
}

/* ==================== SEITE 1: LOGIN ==================== */
.renew-page-login .renew-page-content {
    max-width: 400px;
}

.renew-logo {
    text-align: center;
    margin-bottom: 40px;
}

.renew-logo img {
    max-width: 450px;
    max-height: 300px;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.renew-logo-text {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 64px;
    font-weight: 400;
    color: var(--renew-text-white);
    letter-spacing: 2px;
}

.renew-logo-subtitle {
    font-size: 24px;
    color: var(--renew-gold);
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-top: 10px;
}

.renew-login-form {
    width: 100%;
    background: var(--renew-bg-card);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--renew-shadow);
}

.renew-login-form .renew-form-group {
    margin-bottom: 20px;
}

.renew-login-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--renew-text-light);
    font-size: 14px;
}

.renew-login-form input {
    width: 100%;
    padding: 14px 16px;
    background: var(--renew-input-bg);
    border: 1px solid var(--renew-border);
    border-radius: 8px;
    color: var(--renew-text-white);
    font-size: 16px;
}

.renew-login-form input:focus {
    outline: none;
    border-color: var(--renew-gold);
}

/* ==================== SEITE 2: ABFRAGE ==================== */
.renew-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--renew-border);
}

.renew-logo-small img {
    height: 40px;
    width: auto;
}

.renew-logo-text-small {
    font-family: 'Georgia', serif;
    font-size: 24px;
    color: var(--renew-text-white);
}

.renew-user-info {
    color: var(--renew-text-muted);
    font-size: 14px;
}

/* Suchbereich */
.renew-search-section {
    flex-shrink: 0;
    margin-bottom: 15px;
    position: relative;
}

.renew-search-row {
    display: flex;
    gap: 15px;
}

.renew-search-field {
    flex: 1;
}

.renew-search-field label {
    display: block;
    margin-bottom: 6px;
    color: var(--renew-text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.renew-search-field input {
    width: 100%;
    padding: 14px 16px;
    background: var(--renew-input-bg);
    border: 1px solid var(--renew-border);
    border-radius: 8px;
    color: var(--renew-text-white);
    font-size: 16px;
}

.renew-search-field input:focus {
    outline: none;
    border-color: var(--renew-gold);
}

/* Suchen Button - volle Breite unter den Feldern */
.renew-btn-search {
    width: 100%;
    margin-top: 15px;
    padding: 14px;
    background: var(--renew-gold);
    color: var(--renew-bg-darker);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.renew-btn-search:hover {
    background: var(--renew-gold-light);
}

.renew-btn-search:active {
    transform: scale(0.98);
}

/* Mobile Input Verbesserungen */
input, select, textarea, button {
    font-size: 16px !important; /* Verhindert Zoom auf iOS */
}

/* Autocomplete */
.renew-autocomplete {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--renew-bg-card);
    border: 1px solid var(--renew-border);
    border-radius: 8px;
    margin-top: 8px;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: var(--renew-shadow);
    z-index: 100;
}

.renew-autocomplete ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.renew-autocomplete li {
    padding: 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--renew-border);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.renew-autocomplete li:last-child {
    border-bottom: none;
}

.renew-autocomplete li:hover,
.renew-autocomplete li:active {
    background: var(--renew-input-bg);
}

.renew-autocomplete .customer-name {
    font-weight: 500;
    color: var(--renew-text-white);
}

.renew-autocomplete .customer-info {
    font-size: 13px;
    color: var(--renew-text-muted);
    margin-top: 4px;
}

/* Action Buttons */
.renew-action-buttons {
    flex-shrink: 0;
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.renew-btn-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--renew-bg-card);
    border: 1px solid var(--renew-border);
    border-radius: 50%;
    color: var(--renew-text-white);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.renew-btn-icon:active {
    transform: scale(0.95);
    background: var(--renew-gold);
}

.renew-btn-icon:hover {
    background: var(--renew-gold);
    color: var(--renew-bg-darker);
    border-color: var(--renew-gold);
}

.renew-btn-logout {
    margin-left: auto;
}

.renew-btn-logout:hover {
    background: var(--renew-danger);
    border-color: var(--renew-danger);
    color: white;
}

/* ==================== SCROLLBARER BEREICH ==================== */
.renew-scroll-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding-right: 5px;
}

.renew-scroll-area h3 {
    position: sticky;
    top: 0;
    background: var(--renew-bg-dark);
    color: var(--renew-gold);
    margin: 0 0 15px 0;
    padding: 10px 0;
    font-size: 18px;
    z-index: 10;
}

/* Behandlungsliste */
.treatment-item {
    background: var(--renew-bg-card);
    border: 1px solid var(--renew-border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.treatment-item:hover,
.treatment-item:active {
    border-color: var(--renew-gold);
    transform: translateX(4px);
}

.treatment-item .treatment-date {
    font-weight: 600;
    color: var(--renew-text-white);
    margin-bottom: 6px;
}

.treatment-item .treatment-info {
    font-size: 14px;
    color: var(--renew-text-muted);
}

.treatment-item .treatment-version {
    float: right;
    font-size: 12px;
    color: var(--renew-gold);
    background: rgba(212, 175, 55, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

/* ==================== FOOTER BUTTONS ==================== */
.renew-footer-action {
    flex-shrink: 0;
    padding-top: 15px;
    border-top: 1px solid var(--renew-border);
    margin-top: 15px;
}

.renew-footer-action > div {
    display: flex;
    gap: 12px;
}

/* ==================== SEITE 3: ANLAGE/FORMULAR ==================== */
.renew-form-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 15px;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--renew-border);
}

.renew-form-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--renew-gold);
}

.renew-btn-back {
    background: none;
    border: none;
    color: var(--renew-text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 8px 0;
}

.renew-btn-back:hover {
    color: var(--renew-text-white);
}

/* Formular Panel */
.renew-form-panel {
    padding-bottom: 20px;
}

.renew-form-section {
    background: var(--renew-bg-card);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.renew-form-section h3 {
    position: static;
    background: none;
    margin: 0 0 15px 0;
    padding: 0;
    font-size: 16px;
    color: var(--renew-gold);
    font-weight: 500;
}

.renew-form-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

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

.renew-form-group {
    margin-bottom: 16px;
}

.renew-form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--renew-text-light);
    font-size: 13px;
}

.renew-form-group input,
.renew-form-group select,
.renew-form-group textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--renew-input-bg);
    border: 1px solid var(--renew-border);
    border-radius: 6px;
    color: var(--renew-text-white);
    font-size: 15px;
}

.renew-form-group input:focus,
.renew-form-group select:focus,
.renew-form-group textarea:focus {
    outline: none;
    border-color: var(--renew-gold);
}

.renew-form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

/* Optional-Kennzeichnung */
.renew-optional {
    color: var(--renew-text-muted);
    font-weight: normal;
    font-size: 12px;
}

.renew-form-section h3 .renew-optional {
    margin-left: 5px;
}

/* Detail Ansicht */
.renew-detail-section {
    background: var(--renew-bg-card);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
}

.renew-detail-section h4 {
    margin: 0 0 12px 0;
    color: var(--renew-gold);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.renew-detail-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid var(--renew-border);
}

.renew-detail-row:last-child {
    border-bottom: none;
}

.renew-detail-label {
    flex: 1;
    color: var(--renew-text-muted);
    font-size: 14px;
}

.renew-detail-value {
    flex: 2;
    color: var(--renew-text-white);
    font-size: 14px;
}

.renew-detail-meta {
    margin-top: 20px;
    padding: 15px;
    background: var(--renew-bg-darker);
    border-radius: 6px;
    font-size: 13px;
    color: var(--renew-text-muted);
}

/* ==================== BUTTONS ==================== */
.renew-btn {
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.renew-btn:active {
    transform: scale(0.98);
}

.renew-btn-primary {
    background: var(--renew-gold);
    color: var(--renew-bg-darker);
}

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

.renew-btn-secondary {
    background: var(--renew-bg-card);
    color: var(--renew-text-white);
    border: 1px solid var(--renew-border);
}

.renew-btn-secondary:hover {
    background: var(--renew-input-bg);
}

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

.renew-btn-danger:hover {
    background: #c82333;
}

.renew-btn-full {
    width: 100%;
}

/* ==================== MODAL ==================== */
.renew-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    padding: 20px;
}

.renew-modal-content {
    background: var(--renew-bg-card);
    padding: 30px;
    border-radius: 12px;
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.renew-modal-content h3 {
    margin: 0 0 15px 0;
    color: var(--renew-gold);
}

.renew-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 25px;
}

/* ==================== NOTIFICATIONS ==================== */
.renew-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 14px 24px;
    border-radius: 8px;
    z-index: 100001;
    font-size: 14px;
    box-shadow: var(--renew-shadow);
}

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

.renew-notification.error {
    background: var(--renew-danger);
    color: white;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 480px) {
    .renew-logo-text {
        font-size: 48px;
    }
    
    .renew-logo-subtitle {
        font-size: 18px;
    }
    
    .renew-search-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .renew-form-row {
        flex-direction: column;
    }
    
    .renew-form-row .renew-form-group {
        min-width: 100%;
    }
    
    .renew-footer-action > div {
        flex-direction: column;
    }
    
    .renew-action-buttons {
        flex-wrap: wrap;
    }
}
