/**
 * Visitenkarten-Scanner - Styles
 * Mobile-first Design
 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f5f5;
    color: #333;
    min-height: 100vh;
}

/* ============================================================
   LOGIN
   ============================================================ */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px 30px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    text-align: center;
    width: 100%;
    max-width: 350px;
}

.login-box h1 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #c30;
}

.login-box p {
    color: #666;
    margin-bottom: 20px;
}

.login-box input {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
    margin-bottom: 15px;
}

.login-box input:focus {
    outline: none;
    border-color: #c30;
}

.login-box button {
    width: 100%;
    padding: 15px;
    background: #c30;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

.login-box button:hover {
    background: #a00;
}

.error-msg {
    background: #ffe0e0;
    color: #c30;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
}

/* ============================================================
   APP CONTAINER
   ============================================================ */

.app-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 15px;
    padding-bottom: 100px;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 2px solid #c30;
    margin-bottom: 20px;
}

.app-header h1 {
    font-size: 20px;
    color: #c30;
}

.logout-btn {
    color: #666;
    text-decoration: none;
    font-size: 14px;
}

/* ============================================================
   SECTIONS
   ============================================================ */

.section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.section h2 {
    font-size: 16px;
    color: #333;
    margin-bottom: 15px;
}

.section label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.section input[type="text"],
.section input[type="email"],
.section input[type="tel"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
}

.section input:focus {
    outline: none;
    border-color: #c30;
}

.hint {
    font-size: 13px;
    color: #888;
    margin-top: 8px;
}

/* ============================================================
   CAMERA
   ============================================================ */

.camera-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
}

.camera-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    text-align: center;
    font-size: 40px;
    line-height: 1.5;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
    display: block;
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.btn-primary {
    background: #c30;
    color: white;
}

.btn-primary:hover {
    background: #a00;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #1e7e34;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-large {
    padding: 18px;
    font-size: 18px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================================
   FILE UPLOAD
   ============================================================ */

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

.divider {
    color: #999;
    font-size: 14px;
    margin-bottom: 15px;
}

.upload-section input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    background: #fafafa;
}

/* ============================================================
   OCR RESULT
   ============================================================ */

.ocr-result {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    font-family: monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
}

/* ============================================================
   FORM
   ============================================================ */

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    font-size: 14px;
}

.form-row {
    display: flex;
    gap: 10px;
}

.form-group-small {
    flex: 0 0 100px;
}

.form-group-large {
    flex: 1;
}

.form-divider {
    border: none;
    border-top: 1px solid #eee;
    margin: 20px 0;
}

/* ============================================================
   SCAN STATUS
   ============================================================ */

.scan-status {
    background: #e8f4fd;
    border: 1px solid #b8daff;
    color: #004085;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 500;
}

/* ============================================================
   UPLOAD ROW
   ============================================================ */

.upload-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.upload-item {
    flex: 1;
}

.upload-item label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    color: #555;
}

.upload-item input[type="file"] {
    width: 100%;
    padding: 8px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    background: #fafafa;
    font-size: 12px;
}

/* ============================================================
   STATUS MESSAGES
   ============================================================ */

.status-message {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    z-index: 100;
    animation: slideUp 0.3s ease;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============================================================
   LOADING OVERLAY
   ============================================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #c30;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay p {
    color: #666;
    font-size: 16px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (min-width: 600px) {
    .app-container {
        padding: 30px;
    }
    
    .app-header h1 {
        font-size: 24px;
    }
}

/* ============================================================
   DUPLICATE DIALOG
   ============================================================ */

.duplicate-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.duplicate-dialog {
    background: white;
    border-radius: 12px;
    padding: 20px;
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.duplicate-btn {
    display: block;
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 8px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #f9f9f9;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.duplicate-btn:hover {
    border-color: #0066cc;
    background: #e8f4fd;
}

.duplicate-btn small {
    color: #666;
}

.action-btn {
    display: block;
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 8px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.action-btn.new-btn {
    background: #28a745;
    color: white;
}

.action-btn.edit-btn {
    background: #0066cc;
    color: white;
}

.action-btn.tag-btn {
    background: #17a2b8;
    color: white;
}

.action-btn.cancel-btn {
    background: #6c757d;
    color: white;
}

/* Person List im Dialog */
.person-list,
.company-list {
    margin-bottom: 15px;
}

.person-item,
.company-item {
    display: flex;
    align-items: flex-start;
    padding: 10px;
    margin-bottom: 8px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #f9f9f9;
    cursor: pointer;
    transition: all 0.2s;
}

.person-item:hover,
.company-item:hover {
    border-color: #17a2b8;
    background: #e8f7fa;
}

.person-item.new-item,
.company-item.new-item {
    border-style: dashed;
    background: #fff;
}

.person-item.new-item:hover,
.company-item.new-item:hover {
    border-color: #28a745;
    background: #e8f5e9;
}

.person-item input[type="radio"],
.company-item input[type="radio"] {
    margin-right: 12px;
    margin-top: 4px;
    transform: scale(1.3);
}

.company-item span {
    font-size: 14px;
}

.person-details {
    flex: 1;
    font-size: 13px;
    line-height: 1.4;
}

.person-details strong {
    font-size: 14px;
}

.person-details small {
    color: #666;
}
