/* ============================================
   Empfehlungs-App - Main Stylesheet
   ============================================ */

:root {
    --primary: #22c55e;
    --secondary: #16a34a;
    --accent: #15803d;
    --dark: #1f2937;
    --light: #f9fafb;
    --gray: #6b7280;
    --gray-light: #e5e7eb;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --success: #22c55e;
    --white: #ffffff;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-sm: 4px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--dark);
    background: var(--light);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--secondary), var(--accent));
}

.btn-secondary {
    background: var(--gray-light);
    color: var(--dark);
}

.btn-secondary:hover {
    background: #d1d5db;
}

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

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

.btn-whatsapp {
    background: #25D366;
    color: var(--white);
}

.btn-whatsapp:hover {
    background: #128C7E;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

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

.btn-xs {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

/* ============================================
   Forms
   ============================================ */

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--dark);
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: var(--gray);
    font-size: 13px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-light);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

input[type="color"] {
    width: 60px;
    height: 40px;
    padding: 2px;
    cursor: pointer;
}

input[type="file"] {
    padding: 8px 0;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

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

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.form-actions {
    margin-top: 30px;
    display: flex;
    gap: 10px;
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-prefix {
    background: var(--gray-light);
    padding: 10px 14px;
    border: 1px solid var(--gray-light);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    color: var(--gray);
    font-size: 14px;
    white-space: nowrap;
}

.input-group input {
    border-radius: 0 var(--radius) var(--radius) 0;
    flex: 1;
    min-width: 0;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.button-row .btn {
    white-space: nowrap;
}

.url-preview {
    margin-top: 8px;
    padding: 10px 14px;
    background: var(--light);
    border-radius: var(--radius);
    font-size: 14px;
    word-break: break-all;
}

.url-preview a {
    color: var(--primary);
}

/* ============================================
   Cards
   ============================================ */

.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-light);
}

.card-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* ============================================
   Tables
   ============================================ */

.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--gray-light);
}

.table th {
    font-weight: 600;
    background: var(--light);
    font-size: 13px;
    text-transform: uppercase;
    color: var(--gray);
}

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

/* ============================================
   Stats Grid
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    color: var(--gray);
    font-size: 14px;
    margin-top: 4px;
}

.stats-mini {
    display: flex;
    gap: 20px;
}

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

.stat-mini .value {
    display: block;
    font-size: 24px;
    font-weight: 600;
    color: var(--primary);
}

.stat-mini .label {
    font-size: 12px;
    color: var(--gray);
}

/* ============================================
   Badges
   ============================================ */

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-secondary {
    background: var(--gray-light);
    color: var(--gray);
}

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

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

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

.badge-primary {
    background: #dcfce7;
    color: #166534;
}

/* ============================================
   Alerts
   ============================================ */

.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* ============================================
   Dashboard Layout
   ============================================ */

.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--dark);
    color: var(--white);
    flex-shrink: 0;
}

.admin-sidebar {
    background: #111827;
}

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

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.sidebar-nav {
    padding: 10px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: var(--white);
    text-decoration: none;
}

.nav-item.active {
    background: rgba(255,255,255,0.1);
    color: var(--white);
    border-left: 3px solid var(--primary);
}

.nav-item .icon {
    font-size: 18px;
}

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 10px 0;
}

.nav-logout {
    color: rgba(255,255,255,0.5);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-light);
}

.content-header h1 {
    font-size: 24px;
}

.user-info {
    color: var(--gray);
}

.content-body {
    padding: 30px;
    flex: 1;
}

/* ============================================
   Auth Pages
   ============================================ */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.auth-box {
    background: var(--white);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo h1 {
    font-size: 24px;
    color: var(--dark);
}

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

/* ============================================
   Tenant / Public Pages
   ============================================ */

.tenant-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.tenant-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    flex: 1;
}

.tenant-logo {
    text-align: center;
    margin-bottom: 30px;
}

.tenant-logo img {
    max-height: 80px;
    max-width: 200px;
}

.tenant-footer {
    margin-top: 60px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-light);
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 10px;
}

.footer-links a {
    color: var(--gray);
    font-size: 14px;
}

.copyright {
    color: var(--gray);
    font-size: 13px;
}

/* ============================================
   Landing Page
   ============================================ */

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

.landing-header {
    margin-bottom: 40px;
}

.landing-header h1 {
    font-size: 32px;
    margin-bottom: 12px;
    color: var(--dark);
}

.subheadline {
    font-size: 18px;
    color: var(--gray);
}

.landing-video {
    margin-bottom: 30px;
}

.landing-video iframe {
    width: 100%;
    max-width: 640px;
    aspect-ratio: 16/9;
    border-radius: var(--radius);
}

.landing-description {
    max-width: 600px;
    margin: 0 auto 30px;
    color: var(--gray);
}

.landing-cta {
    margin: 40px 0;
}

.referrer-info {
    background: #dcfce7;
    padding: 16px 24px;
    border-radius: var(--radius);
    display: inline-block;
    margin-bottom: 20px;
}

.contact-options {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--gray-light);
}

.contact-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
}

/* ============================================
   Registration Page
   ============================================ */

.registration-page {
    max-width: 600px;
    margin: 0 auto;
}

.registration-page h1 {
    text-align: center;
    margin-bottom: 30px;
}

.form-section {
    margin-bottom: 30px;
}

.form-section h3 {
    margin-bottom: 16px;
    color: var(--dark);
}

.rewards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.reward-option {
    cursor: pointer;
}

.reward-option input {
    display: none;
}

.reward-card {
    background: var(--white);
    border: 2px solid var(--gray-light);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    transition: all 0.2s;
}

.reward-option input:checked + .reward-card {
    border-color: var(--primary);
    background: #f0fdf4;
}

.reward-card img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-bottom: 10px;
}

.reward-card h4 {
    font-size: 14px;
    margin-bottom: 4px;
}

.reward-card p {
    font-size: 12px;
    color: var(--gray);
}

/* ============================================
   Thank You Page
   ============================================ */

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

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--primary);
    color: var(--white);
    font-size: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
}

.thankyou-page h1 {
    margin-bottom: 16px;
}

.greeting {
    font-size: 18px;
    color: var(--gray);
    margin-bottom: 40px;
}

.referral-link-box {
    background: var(--white);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.referral-link-box h3 {
    margin-bottom: 16px;
}

.link-display {
    display: flex;
    gap: 10px;
}

.link-display input {
    flex: 1;
    background: var(--light);
}

.share-options {
    margin: 30px 0;
}

.share-options h3 {
    margin-bottom: 16px;
}

.qr-code-section {
    margin-top: 40px;
}

.qr-code {
    border-radius: var(--radius);
}

.qr-hint {
    margin-top: 10px;
    color: var(--gray);
    font-size: 14px;
}

/* ============================================
   Counter Controls
   ============================================ */

.counter-control {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.counter-btn {
    width: 24px;
    height: 24px;
    border: 1px solid var(--gray-light);
    background: var(--white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.counter-btn:hover {
    background: var(--gray-light);
}

.counter-value {
    min-width: 30px;
    text-align: center;
}

/* ============================================
   Modal
   ============================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-light);
}

.modal-header h3 {
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--gray-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============================================
   Rewards List (Dashboard)
   ============================================ */

.rewards-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.reward-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--light);
    border-radius: var(--radius);
}

.reward-item.inactive {
    opacity: 0.6;
}

.reward-item img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.reward-info {
    flex: 1;
}

.reward-info h4 {
    margin-bottom: 4px;
}

.reward-info p {
    color: var(--gray);
    font-size: 14px;
    margin-bottom: 8px;
}

.reward-actions {
    display: flex;
    gap: 8px;
}

/* ============================================
   Detail Grid
   ============================================ */

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.detail-list {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 12px;
}

.detail-list dt {
    color: var(--gray);
    font-size: 14px;
}

.detail-list dd {
    font-weight: 500;
}

.breadcrumb {
    margin-bottom: 20px;
    color: var(--gray);
}

.breadcrumb a {
    color: var(--gray);
}

/* ============================================
   Form Grid
   ============================================ */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

/* ============================================
   Utilities
   ============================================ */

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

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

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

.desktop-only {
    display: block;
}

code {
    background: var(--light);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

/* ============================================
   Error Pages
   ============================================ */

.error-page {
    text-align: center;
    padding: 100px 20px;
}

.error-page h1 {
    font-size: 120px;
    color: var(--gray-light);
    line-height: 1;
}

.error-page p {
    margin: 20px 0 30px;
    color: var(--gray);
}

.registration-closed-page {
    text-align: center;
    padding: 60px 20px;
}

.warning-icon {
    font-size: 60px;
    color: var(--warning);
    margin-bottom: 20px;
}

/* ============================================
   Home Page
   ============================================ */

.home-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.hero {
    text-align: center;
    color: var(--white);
    padding: 40px 20px;
}

.hero h1 {
    font-size: 48px;
    margin-bottom: 16px;
}

.hero p {
    font-size: 20px;
    opacity: 0.9;
    margin-bottom: 30px;
}

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

.hero .btn:hover {
    background: var(--light);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    .dashboard-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        position: fixed;
        bottom: 0;
        z-index: 100;
    }

    .sidebar-header {
        display: none;
    }

    .sidebar-nav {
        display: flex;
        overflow-x: auto;
        padding: 0;
    }

    .nav-item {
        flex-direction: column;
        padding: 10px 15px;
        font-size: 12px;
        gap: 4px;
    }

    .nav-divider,
    .nav-logout {
        display: none;
    }

    .main-content {
        padding-bottom: 70px;
    }

    .content-header {
        padding: 16px 20px;
    }

    .content-header h1 {
        font-size: 20px;
    }

    .content-body {
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .desktop-only {
        display: none;
    }

    .link-display {
        flex-direction: column;
    }

    .contact-buttons {
        flex-direction: column;
    }

    .table th,
    .table td {
        padding: 8px;
        font-size: 13px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}
