/* ==========================================================================
   Deklaracje POZ - Style (High Contrast Medical Theme - Grupa Euromedica)
   ========================================================================== */

:root {
    --bg-page: #e2e8f0;
    --bg-card: #ffffff;
    --bg-section: #ffffff;
    --bg-input: #f8fafc;
    --text-main: #0f172a;
    --text-body: #1e293b;
    --text-muted: #475569;
    --brand-blue: #0284c7;
    --brand-blue-dark: #0369a1;
    --brand-navy: #0f172a;
    --brand-teal: #0d9488;
    --border-section: #cbd5e1;
    --border-input: #94a3b8;
    --input-focus: #0284c7;
    --error-color: #dc2626;
    --success-color: #16a34a;
    --radius: 16px;
    --radius-sm: 8px;
    --transition: all 0.2s ease-in-out;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #e2e8f0;
    color: var(--text-body);
    line-height: 1.6;
    min-height: 100vh;
    padding: 2.5rem 1rem;
}

.container {
    max-width: 940px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

/* Header & Branding */
.form-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
}

.site-logo-img {
    max-height: 100px;
    max-width: 380px;
    height: auto;
    width: auto;
    object-fit: contain;
}

.main-title {
    font-size: 1.4rem;
    font-weight: 800;
    text-align: center;
    color: var(--brand-navy);
    line-height: 1.4;
    max-width: 850px;
    margin: 0 auto;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Form Container */
.glass-form {
    background: var(--bg-card);
    border: 2px solid #cbd5e1;
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.12);
}

.form-section {
    margin-bottom: 2.25rem;
    background: #ffffff;
    padding: 1.75rem 2rem;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-section);
    border-left: 5px solid var(--brand-blue);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
}

.form-section:last-child {
    margin-bottom: 0;
}

h2.section-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--brand-navy);
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e0f2fe;
    line-height: 1.4;
}

h2.section-title::before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: var(--brand-blue);
    border-radius: 50%;
    margin-right: 0.6rem;
    vertical-align: middle;
    position: relative;
    top: -1px;
}

h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.85rem;
    color: var(--brand-navy);
}

p {
    margin-bottom: 0.75rem;
}

a {
    color: var(--brand-blue);
    font-weight: 600;
    text-decoration: underline;
    transition: var(--transition);
}

a:hover {
    color: var(--brand-blue-dark);
}

.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.9rem; }
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 0.75rem !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 2.5rem !important; }
.my-3 { margin-top: 1rem !important; margin-bottom: 1rem !important; }

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Form Controls */
.form-group {
    display: flex;
    flex-direction: column;
}

label {
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 0.45rem;
    color: var(--text-main);
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="date"],
select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1.5px solid var(--border-input);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.98rem;
    font-weight: 500;
    font-family: inherit;
    transition: var(--transition);
}

input:focus,
select:focus {
    outline: none;
    background: #ffffff;
    border-color: var(--input-focus);
    box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.2);
}

.readonly-input {
    background: #e2e8f0 !important;
    color: #475569 !important;
    font-weight: 700 !important;
    cursor: not-allowed;
    border-color: #cbd5e1 !important;
}

/* Radio & Checkbox */
.radio-group {
    display: flex;
    gap: 1.75rem;
}

.radio-group-vertical {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.radio-label,
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.93rem;
    font-weight: 500;
    color: var(--text-body);
    line-height: 1.5;
    background: #f8fafc;
    padding: 0.75rem 1rem;
    border: 1.5px solid #cbd5e1;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.radio-label:hover,
.checkbox-label:hover {
    border-color: var(--brand-blue);
    background: #f0f9ff;
}

input[type="radio"],
input[type="checkbox"] {
    appearance: none;
    background-color: #ffffff;
    margin: 0;
    font: inherit;
    color: currentColor;
    width: 1.35em;
    height: 1.35em;
    border: 2px solid #64748b;
    border-radius: 4px;
    display: grid;
    place-content: center;
    margin-top: 0.1rem;
    flex-shrink: 0;
    cursor: pointer;
    transition: var(--transition);
}

input[type="radio"] {
    border-radius: 50%;
}

input[type="radio"]::before {
    content: "";
    width: 0.65em;
    height: 0.65em;
    border-radius: 50%;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em var(--brand-blue);
}

input[type="checkbox"]::before {
    content: "";
    width: 0.7em;
    height: 0.7em;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em var(--brand-blue);
    transform-origin: center;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

input[type="radio"]:checked::before,
input[type="checkbox"]:checked::before {
    transform: scale(1);
}

input[type="radio"]:checked,
input[type="checkbox"]:checked {
    border-color: var(--brand-blue);
}

/* Objaśnienia Box */
.explanations-box {
    background: #f0f9ff !important;
    border: 2px solid #7dd3fc !important;
    color: #0369a1 !important;
    border-radius: var(--radius-sm);
    padding: 1.25rem 1.5rem !important;
}

.explanations-box h3 {
    color: #0284c7 !important;
    border-bottom: 2px solid #bae6fd !important;
    font-weight: 800 !important;
}

.explanations-box li {
    font-size: 0.9rem;
    font-weight: 500;
    color: #0c4a6e;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-weight: 700;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-large {
    padding: 1.1rem 2.25rem;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
}

.btn-primary {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(2, 132, 199, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(2, 132, 199, 0.45);
}

.btn-primary:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-outline {
    background: #ffffff;
    border: 2px solid var(--brand-blue);
    color: var(--brand-blue);
    font-weight: 700;
}

.btn-outline:hover {
    background: #e0f2fe;
}

/* Signatures */
.signature-box {
    background: #f8fafc;
    padding: 1.25rem;
    border-radius: var(--radius-sm);
    border: 1.5px solid #cbd5e1;
}

.canvas-wrapper {
    background: #ffffff;
    border: 2.5px solid var(--brand-blue);
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

canvas {
    display: block;
    width: 100%;
    max-width: 400px;
    height: 200px;
    touch-action: none;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.alert-success {
    background: #f0fdf4;
    border: 2px solid #22c55e;
    color: #15803d;
}

.alert-error {
    background: #fef2f2;
    border: 2px solid #ef4444;
    color: #b91c1c;
}

/* Footer */
footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.4);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    margin-right: 10px;
}

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

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 1rem 0.5rem;
    }
    
    .glass-form {
        padding: 1.25rem 1rem;
    }
    
    .form-section {
        padding: 1.25rem 1rem;
    }

    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
    
    .signatures-section .grid-2 {
        grid-template-columns: 1fr;
    }
    
    .radio-group {
        flex-direction: column;
        gap: 0.65rem;
    }
    
    .main-title {
        font-size: 1.2rem;
    }
}
