/**
 * MSW Emergency Information Card - Stylesheet
 * Version: 1.1.0
 * Medical/emergency theme with red accents for seniors 55+
 * Internationalised: AU, NZ, UK, US, CA
 */

/* ==========================================================================
   BASE
   ========================================================================== */

.msw-emergency-card {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px 25px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 18px;
    line-height: 1.6;
    color: #333;
}

.msw-emergency-card *,
.msw-emergency-card *::before,
.msw-emergency-card *::after {
    box-sizing: border-box;
}

/* ==========================================================================
   HEADER
   ========================================================================== */

.msw-emergency-card .msw-calculator__header {
    text-align: center;
    margin-bottom: 25px;
}

.msw-emergency-card .msw-calculator__title {
    font-size: 32px;
    font-weight: 700;
    color: #C0392B;
    margin: 0 0 8px 0;
}

.msw-emergency-card .msw-calculator__subtitle {
    font-size: 20px;
    color: #666;
    margin: 0;
}

/* ==========================================================================
   INSTRUCTIONS
   ========================================================================== */

.msw-emergency-card .msw-calculator__instructions {
    background: #FFF5F5;
    border: 2px solid #E74C3C;
    border-radius: 8px;
    padding: 20px 25px;
    margin-bottom: 30px;
}

.msw-emergency-card .msw-calculator__instructions p {
    margin: 0 0 8px 0;
}

.msw-emergency-card .msw-calculator__instructions p:last-child {
    margin-bottom: 0;
}

.msw-logged-in-notice {
    color: #2E7D32;
    font-weight: 600;
}

/* ==========================================================================
   COUNTRY SELECTOR
   ========================================================================== */

.msw-form-section--country {
    background: #F0F7FF !important;
    border-color: #3498DB !important;
}

.msw-form-section--country .msw-form-section__title {
    color: #2980B9 !important;
}

.msw-form-select--country {
    font-size: 18px !important;
    font-weight: 600;
}

.ec-emergency-number-display {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 10px 14px;
    background: #C0392B;
    color: #FFF;
    border-radius: 6px;
    font-size: 20px;
    font-weight: 600;
    justify-content: center;
}

.ec-emergency-number-display strong {
    font-size: 28px;
    margin-left: 8px;
    letter-spacing: 2px;
}

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

.msw-emergency-card .msw-form-section {
    background: #FFF;
    border: 2px solid #E8E8E8;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
}

.msw-emergency-card .msw-form-section__title {
    font-size: 22px;
    font-weight: 700;
    color: #C0392B;
    margin: 0 0 15px 0;
}

.msw-form-hint {
    font-size: 15px;
    color: #888;
    margin: 0 0 12px 0;
}

.msw-form-row {
    display: grid;
    gap: 15px;
    margin-bottom: 12px;
}

.msw-form-row--2col { grid-template-columns: 1fr 1fr; }
.msw-form-row--3col { grid-template-columns: 1fr 1fr 1fr; }

.msw-form-group {
    margin-bottom: 8px;
}

.msw-form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 16px;
}

.msw-form-input,
.msw-form-select,
.msw-form-textarea {
    width: 100%;
    border: 2px solid #CCC;
    border-radius: 6px;
    font-size: 17px;
    font-family: inherit;
    background: #FFF;
    color: #333;
    transition: border-color 0.2s;
}

.msw-form-input:focus,
.msw-form-select:focus,
.msw-form-textarea:focus {
    border-color: #E74C3C;
    outline: none;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.12);
}

.msw-form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* ==========================================================================
   REPEATER ROWS
   ========================================================================== */

.msw-repeater-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.msw-repeater-row .msw-form-input {
    flex: 1;
}

.msw-repeater-row--med {
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr 36px;
    gap: 8px;
    align-items: center;
}

.msw-repeater-row--allergy {
    display: grid;
    grid-template-columns: 1fr 1fr 36px;
    gap: 8px;
    align-items: center;
}

.msw-repeater-row--contact {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr 36px;
    gap: 8px;
    align-items: center;
}

.msw-repeater-row--specialist {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr 36px;
    gap: 8px;
    align-items: center;
}

.msw-btn-remove {
    background: #E74C3C;
    color: #FFF;
    border: none;
    border-radius: 4px;
    width: 36px;
    height: 36px;
    min-width: 36px;
    cursor: pointer;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.msw-btn-remove:hover { background: #C0392B; }

.msw-btn-add {
    padding: 10px 18px;
    background: #FFF;
    color: #C0392B;
    border: 2px dashed #E74C3C;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    margin-top: 8px;
}

.msw-btn-add:hover { background: #FFF5F5; }

/* ==========================================================================
   CHECKBOXES
   ========================================================================== */

.msw-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 25px;
}

.msw-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 16px;
}

.msw-checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

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

.msw-calculator__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 25px 0;
}

.msw-button {
    padding: 14px 24px;
    border-radius: 6px;
    font-size: 18px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 2px solid;
    transition: all 0.2s;
    line-height: 1.3;
}

.msw-button--primary {
    background: #C0392B;
    color: #FFF;
    border-color: #C0392B;
}

.msw-button--primary:hover {
    background: #A93226;
    border-color: #A93226;
}

.msw-button--secondary {
    background: #FFF;
    color: #C0392B;
    border-color: #C0392B;
}

.msw-button--secondary:hover { background: #FFF5F5; }

.msw-button--save {
    background: #27AE60;
    color: #FFF;
    border-color: #27AE60;
}

.msw-button--save:hover {
    background: #219A52;
    border-color: #219A52;
}

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

.msw-status {
    padding: 14px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 600;
}

.msw-status--success { background: #E8F5E9; color: #2E7D32; border: 1px solid #A5D6A7; }
.msw-status--error { background: #FFEBEE; color: #C62828; border: 1px solid #EF9A9A; }
.msw-status--info { background: #E3F2FD; color: #1565C0; border: 1px solid #90CAF9; }

/* ==========================================================================
   PRINT PREVIEW
   ========================================================================== */

.msw-print-preview {
    margin-top: 30px;
    padding: 25px;
    background: #F5F5F5;
    border-radius: 8px;
}

.msw-preview-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.ec-print-instructions {
    text-align: center;
    color: #666;
    font-style: italic;
    margin-top: 20px;
    font-size: 16px;
}

/* ==========================================================================
   WALLET CARD (86mm x 54mm credit card size)
   ========================================================================== */

.ec-wallet-card {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.wc-page {
    width: 340px;
    min-height: 214px;
    border: 2px solid #333;
    border-radius: 8px;
    overflow: hidden;
    background: #FFF;
    font-size: 11px;
    line-height: 1.35;
}

.wc-header {
    background: #C0392B;
    color: #FFF;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wc-header--back {
    background: #2C3E50;
}

.wc-cross {
    font-size: 20px;
    font-weight: 700;
}

.wc-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.wc-body {
    padding: 8px 10px;
}

.wc-row {
    margin-bottom: 3px;
}

.wc-alerts {
    margin: 6px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.alert-badge {
    display: inline-block;
    background: #E74C3C;
    color: #FFF;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.wc-section {
    margin-top: 6px;
    padding-top: 5px;
    border-top: 1px solid #DDD;
}

.wc-section-title {
    font-size: 9px;
    font-weight: 700;
    color: #C0392B;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

.wc-back .wc-section-title {
    color: #2C3E50;
}

.wc-allergy {
    display: inline-block;
    background: #FFEBEE;
    color: #C62828;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    margin: 1px 2px;
}

.wc-conditions {
    font-size: 10px;
}

.wc-med {
    font-size: 10px;
    padding: 2px 0;
    border-bottom: 1px dotted #EEE;
}

.wc-med:last-child { border-bottom: none; }

.wc-contact {
    font-size: 10px;
    padding: 3px 0;
    border-bottom: 1px dotted #EEE;
}

.wc-contact:last-child { border-bottom: none; }

.wc-acd {
    margin-top: 6px;
    font-size: 9px;
    font-weight: 600;
    color: #E67E22;
}

.wc-footer {
    padding: 4px 10px;
    background: #F5F5F5;
    font-size: 9px;
    color: #999;
    text-align: right;
}

/* ==========================================================================
   FRIDGE CARD (A4 page, high visibility)
   ========================================================================== */

.ec-fridge-card {
    max-width: 700px;
    margin: 0 auto;
}

.fc-border {
    border: 4px solid #C0392B;
    border-radius: 12px;
    overflow: hidden;
    background: #FFF;
}

.fc-header {
    background: #C0392B;
    color: #FFF;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.fc-cross {
    font-size: 36px;
    font-weight: 700;
    flex-shrink: 0;
}

.fc-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
}

.fc-subtitle {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.fc-emergency-num {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    margin-top: 4px;
    background: rgba(255, 255, 255, 0.2);
    display: inline-block;
    padding: 2px 12px;
    border-radius: 4px;
}

.fc-personal {
    padding: 15px 20px;
    border-bottom: 2px solid #E8E8E8;
}

.fc-personal-row {
    margin-bottom: 8px;
}

.fc-name {
    font-size: 26px;
    font-weight: 700;
    color: #333;
}

.fc-personal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px 20px;
    font-size: 15px;
}

.fc-blood {
    background: #C0392B;
    color: #FFF;
    padding: 1px 8px;
    border-radius: 3px;
    font-weight: 700;
}

.fc-alerts {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.fc-alerts .alert-badge {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 4px;
}

.fc-section {
    padding: 12px 20px;
    border-bottom: 1px solid #E8E8E8;
}

.fc-section:last-of-type { border-bottom: none; }

.fc-section-title {
    font-size: 16px;
    font-weight: 700;
    color: #C0392B;
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

.fc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.fc-table th {
    background: #F5F5F5;
    font-weight: 600;
    text-align: left;
    padding: 6px 10px;
    border: 1px solid #E0E0E0;
    font-size: 13px;
    color: #666;
}

.fc-table td {
    padding: 6px 10px;
    border: 1px solid #E0E0E0;
    vertical-align: top;
}

.fc-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.fc-tag {
    background: #FFF5F5;
    color: #C0392B;
    border: 1px solid #E74C3C;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 14px;
}

.fc-acd {
    background: #FFF3E0;
    border: 1px solid #E67E22;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.fc-footer {
    background: #F5F5F5;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #999;
}

/* ==========================================================================
   TIPS
   ========================================================================== */

.msw-tips {
    background: #F9F9F9;
    padding: 30px;
    border-radius: 8px;
    border: 2px solid #E8E8E8;
    margin-top: 30px;
}

.msw-tips__title {
    font-size: 24px;
    font-weight: 600;
    color: #C0392B;
    margin: 0 0 20px 0;
}

.msw-tips__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.msw-tips__list li {
    padding: 12px 0 12px 35px;
    position: relative;
    border-bottom: 1px solid #E8E8E8;
}

.msw-tips__list li:last-child { border-bottom: none; }

.msw-tips__list li::before {
    content: "🏥";
    position: absolute;
    left: 0;
    font-size: 18px;
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    body { background: #FFF; margin: 0; padding: 0; }

    .msw-emergency-card {
        padding: 0;
        max-width: none;
    }

    .msw-calculator__header,
    .msw-calculator__instructions,
    .msw-calculator__form,
    .msw-calculator__actions,
    .msw-status,
    .msw-preview-actions,
    .msw-tips,
    .ec-print-instructions {
        display: none !important;
    }

    .msw-print-preview {
        background: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .ec-wallet-card {
        display: flex;
        gap: 10mm;
        justify-content: center;
    }

    .wc-page {
        width: 86mm;
        min-height: 54mm;
        border: 1px solid #333;
        break-inside: avoid;
    }

    .ec-fridge-card {
        max-width: none;
    }

    .fc-border {
        border-width: 3px;
    }
}

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

@media (max-width: 768px) {
    .msw-emergency-card { padding: 15px 12px; }

    .msw-emergency-card .msw-calculator__title { font-size: 26px; }

    .msw-form-row--2col,
    .msw-form-row--3col { grid-template-columns: 1fr; }

    .msw-repeater-row--med { grid-template-columns: 1fr 36px; }
    .msw-repeater-row--med .ec-med-name { grid-column: 1; }
    .msw-repeater-row--med .ec-med-dosage,
    .msw-repeater-row--med .ec-med-freq { grid-column: 1; }
    .msw-repeater-row--med .msw-btn-remove { grid-row: 1; grid-column: 2; }

    .msw-repeater-row--allergy { grid-template-columns: 1fr 36px; }
    .msw-repeater-row--allergy .ec-reaction { grid-column: 1; }

    .msw-repeater-row--contact { grid-template-columns: 1fr 1fr 36px; }
    .msw-repeater-row--contact .ec-contact-name { grid-column: 1 / 3; }
    .msw-repeater-row--contact .msw-btn-remove { grid-row: 1; grid-column: 3; }

    .msw-repeater-row--specialist { grid-template-columns: 1fr 36px; }
    .msw-repeater-row--specialist .msw-btn-remove { grid-row: 1; grid-column: 2; }

    .msw-calculator__actions { flex-direction: column; }

    .msw-checkbox-group { flex-direction: column; gap: 10px; }

    .ec-wallet-card { flex-direction: column; align-items: center; }

    .fc-personal-grid { grid-template-columns: 1fr; }

    .ec-emergency-number-display {
        margin-top: 8px;
    }
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

*:focus-visible {
    outline: 3px solid #E74C3C;
    outline-offset: 2px;
}
