/* ==========================================================================
   esanum Selbstauskunft – Design System CSS
   Based on esanum Design System tokens
   ========================================================================== */

/* ---------- Design Tokens ---------- */
:root {
    /* Primary (teal) */
    --primary-dark:     #003E48;
    --primary:          #005461;
    --primary-mid:      #407F89;
    --primary-light:    #7FA9B0;
    --primary-lighter:  #BFD4D7;
    --primary-bg:       #E5EEEF;

    /* Secondary (cyan) */
    --secondary:        #00A5AE;
    --secondary-light:  #40BCC2;
    --secondary-lighter:#7FD2D6;
    --secondary-bg:     #BFE8EB;
    --secondary-pale:   #E5F6F7;

    /* Accent / Error */
    --error:            #BE182D;
    --error-light:      #F25F5C;
    --success:          #76A530;
    --warning:          #BAAA00;
    --info:             #3296C1;

    /* Neutrals */
    --gray-900:         #444444;
    --gray-700:         #737373;
    --gray-500:         #A1A1A1;
    --gray-300:         #D0D0D0;
    --gray-200:         #E0E0E0;
    --gray-100:         #ECECEC;
    --gray-50:          #F3F3F3;
    --gray-25:          #F5F5F5;
    --white:            #FFFFFF;

    /* Spacing (gutter-base: 15px) */
    --space-xs:   5px;
    --space-sm:   8px;
    --space-md:   15px;
    --space-lg:   20px;
    --space-xl:   25px;
    --space-2xl:  30px;
    --space-3xl:  45px;

    /* Corners */
    --radius-sm:  3px;
    --radius-md:  5px;
    --radius-lg:  10px;

    /* Shadows */
    --shadow-card:    0px 1px 2px rgba(0, 0, 0, 0.13);
    --shadow-raised:  0px 4px 15px rgba(0, 0, 0, 0.15);
    --shadow-button:  0px 4px 9px rgba(0, 0, 0, 0.3);

    /* Typography */
    --font-sans:  'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-serif: 'Noto Serif', Georgia, serif;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    color: var(--gray-900);
    background: var(--gray-50);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---------- Header ---------- */
.header {
    background: var(--primary);
    box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 860px;
    margin: 0 auto;
    padding: 12px var(--space-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Language Switch */
.lang-switch {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lang-btn {
    background: none;
    border: none;
    color: var(--primary-light);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.lang-btn:hover {
    color: var(--white);
}

.lang-btn.active {
    color: var(--white);
    background: rgba(255, 255, 255, 0.15);
}

.lang-divider {
    color: var(--primary-mid);
    font-size: 13px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-icon {
    flex-shrink: 0;
}

.logo-text {
    font-size: 22px;
    font-weight: 700;
    color: var(--white);
    letter-spacing: 0.02em;
}

/* ---------- Main ---------- */
.main {
    flex: 1;
    padding: var(--space-3xl) var(--space-md) 60px;
}

.container {
    max-width: 820px;
    margin: 0 auto;
}

/* ---------- Page Title ---------- */
.page-title {
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 30px;
    line-height: 1.3;
    color: var(--primary);
    margin-bottom: 8px;
}

.page-subtitle {
    font-size: 15px;
    color: var(--gray-700);
    margin-bottom: var(--space-3xl);
    line-height: 1.6;
}

/* ---------- Form Sections ---------- */
.form-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: var(--space-2xl) var(--space-2xl) var(--space-xl);
    margin-bottom: var(--space-lg);
    border: 1px solid var(--gray-200);
}

.section-title {
    font-weight: 700;
    font-size: 18px;
    line-height: 1.3;
    color: var(--secondary);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--secondary-pale);
}

/* ---------- Form Grid ---------- */
.form-grid {
    display: grid;
    gap: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-xs);
}

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

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

.address-pair {
    display: flex;
    gap: var(--space-md);
}

/* ---------- Form Group ---------- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    line-height: 1.2;
    letter-spacing: 0.005em;
}

.required {
    color: var(--error);
}

/* ---------- Inputs ---------- */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="number"],
select,
textarea {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    color: var(--gray-900);
    background: var(--gray-50);
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    transition: all 0.2s ease;
    width: 100%;
}

input::placeholder,
textarea::placeholder {
    color: var(--gray-500);
    font-size: 13px;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23737373' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
    cursor: pointer;
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--primary-mid);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--secondary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(0, 165, 174, 0.15);
}

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

/* ---------- Error State ---------- */
.form-group.error input,
.form-group.error select,
.form-group.error textarea {
    border-color: var(--error);
    background: #FFF5F5;
}

.form-group.error input:focus,
.form-group.error select:focus,
.form-group.error textarea:focus {
    box-shadow: 0 0 0 3px rgba(190, 24, 45, 0.12);
}

.form-group.error label {
    color: var(--error);
}

.error-message {
    font-size: 12px;
    color: var(--error);
    margin-top: 2px;
    font-weight: 500;
}

/* ---------- Submit Button ---------- */
.form-actions {
    text-align: center;
    margin-top: var(--space-xl);
    margin-bottom: var(--space-lg);
}

.btn {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
    letter-spacing: 0.005em;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    padding: 14px 40px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--secondary);
    color: var(--white);
    box-shadow: var(--shadow-card);
}

.btn-primary:hover {
    background: #009199;
    box-shadow: var(--shadow-button);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-card);
}

.btn-primary:disabled {
    background: var(--gray-500);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.spinner {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- Footer ---------- */
.footer {
    background: var(--primary-dark);
    color: var(--primary-light);
    padding: var(--space-lg) var(--space-md);
    margin-top: auto;
}

.footer-inner {
    max-width: 820px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    letter-spacing: 0.005em;
}

/* ---------- Responsive ---------- */
@media (max-width: 680px) {
    .page-title {
        font-size: 26px;
    }

    .form-section {
        padding: var(--space-lg) var(--space-md) var(--space-md);
    }

    .form-grid.two-col,
    .form-grid.address-row {
        grid-template-columns: 1fr;
    }

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

    .form-grid.address-row .plz,
    .form-grid.address-row .ort {
        grid-column: span 1;
    }

    .footer-inner {
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .main {
        padding: var(--space-lg) var(--space-sm) 40px;
    }

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

    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ---------- Admin Styles ---------- */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2xl);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.admin-header h1 {
    font-size: 30px;
    color: var(--primary);
}

.admin-actions {
    display: flex;
    gap: var(--space-sm);
}

.btn-outline {
    background: var(--white);
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary-bg);
}

.btn-sm {
    padding: 8px 18px;
    font-size: 13px;
}

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

.btn-danger:hover {
    background: #a0152a;
}

/* Admin Table */
.admin-table-wrap {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--gray-200);
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table th {
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 12px 16px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 2px solid var(--primary-lighter);
}

.admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-900);
    vertical-align: top;
}

.admin-table tr:hover td {
    background: var(--secondary-pale);
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: var(--secondary-pale);
    color: var(--primary);
}

.empty-state {
    text-align: center;
    padding: var(--space-3xl);
    color: var(--gray-500);
}

.empty-state svg {
    margin-bottom: var(--space-md);
    opacity: 0.4;
}

/* Detail View */
.detail-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    margin-bottom: var(--space-lg);
}

.detail-section-title {
    background: var(--primary-bg);
    color: var(--secondary);
    font-weight: 700;
    font-size: 15px;
    padding: 12px 24px;
    border-bottom: 2px solid var(--secondary-pale);
}

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

.detail-item {
    padding: 14px 24px;
    border-bottom: 1px solid var(--gray-100);
}

.detail-item:nth-child(odd) {
    border-right: 1px solid var(--gray-100);
}

.detail-item.full-width {
    grid-column: 1 / -1;
    border-right: none;
}

.detail-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 15px;
    color: var(--gray-900);
    word-break: break-word;
}

.detail-value.empty {
    color: var(--gray-300);
    font-style: italic;
}

.detail-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
}

/* Flash Messages */
.flash {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    font-size: 14px;
    font-weight: 500;
}

.flash.success {
    background: #f0f9e8;
    color: #4a7a1a;
    border: 1px solid #c5e1a5;
}

.flash.error {
    background: #fef2f2;
    color: var(--error);
    border: 1px solid #fecaca;
}

/* Success Page */
.success-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-raised);
    padding: 60px 40px;
    text-align: center;
    max-width: 560px;
    margin: 0 auto;
}

.success-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #e8f5e9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-xl);
}

.success-card h1 {
    font-size: 26px;
    color: var(--primary);
    margin-bottom: var(--space-sm);
}

.success-card p {
    color: var(--gray-700);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: var(--space-xl);
}

.btn-ghost {
    background: transparent;
    color: var(--secondary);
    border: 1.5px solid var(--secondary);
}

.btn-ghost:hover {
    background: var(--secondary-pale);
}

@media (max-width: 680px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-item:nth-child(odd) {
        border-right: none;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ---------------------------------------------------------------------- */
/* Embed mode (?embed=1) – used when rendered inside a Smartiframe.       */
/* Strips vertical rhythm that assumes a header/footer above/below.       */
/* ---------------------------------------------------------------------- */
body.embed {
    background: transparent;
}
body.embed .main {
    padding-top: 0;
    padding-bottom: 0;
}
body.embed .container {
    padding-top: 16px;
    padding-bottom: 16px;
}
body.embed .success-card {
    margin-top: 0;
}
