/**
 * Danger Drug Checker — Styles
 * Version: 1.3.0
 * HelpSafe Team
 */

/* ==========================================
   BASE & CONTAINER
   ========================================== */
.ddc-container {
    max-width: 850px;
    margin: 30px auto;
    padding: 25px;
    border: 2px solid #189589;
    border-radius: 10px;
    background: #f9f9f9;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-sizing: border-box;
}

.ddc-container h2 {
    margin-top: 0;
    color: #333;
    font-size: 1.8em;
    margin-bottom: 15px;
    line-height: 1.3;
}

/* ==========================================
   STATS BLOCK
   ========================================== */
.ddc-db-stats {
    margin: 10px 0 20px;
    padding: 10px 15px;
    background: #f0f8f7;
    border-left: 3px solid #189589;
    border-radius: 4px;
    font-size: 0.95em;
    color: #333;
    line-height: 1.4;
}

.ddc-db-stats strong {
    color: #189589;
    font-size: 1.15em;
    font-weight: 700;
}

/* ==========================================
   FORM
   ========================================== */
#ddc-search-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#ddc-search-form label {
    font-weight: 600;
    margin-bottom: 5px;
    display: block;
    color: #333;
}

#ddc-drug-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #189589;
    border-radius: 6px;
    font-size: 1.1em;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#ddc-drug-input:focus {
    outline: none;
    border-color: #147a6f;
    box-shadow: 0 0 0 3px rgba(24, 149, 137, 0.15);
}

.ddc-input-wrapper {
    position: relative;
    width: 100%;
}

/* Согласие */
.ddc-agree-wrapper {
    margin: 5px 0;
}

.ddc-agree-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.9em;
    line-height: 1.4;
    cursor: pointer;
    color: #444;
}

.ddc-agree-label input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.ddc-agree-label a {
    color: #189589;
    text-decoration: none;
    font-weight: 500;
}

.ddc-agree-label a:hover {
    text-decoration: underline;
}

/* Кнопка */
#ddc-submit-btn {
    padding: 14px 20px;
    background: #189589;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.05em;
    font-weight: 600;
    transition: background 0.2s, transform 0.1s;
    margin-top: 5px;
}

#ddc-submit-btn:hover {
    background: #147a6f;
}

#ddc-submit-btn:active {
    transform: translateY(1px);
}

#ddc-submit-btn:disabled {
    background: #aaa;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================
   RESULT & MESSAGES
   ========================================== */
.ddc-result {
    margin-top: 25px;
}

.ddc-loading {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 15px;
}

.ddc-msg.ddc-error {
    color: #b00020;
    background: #ffebee;
    padding: 14px 18px;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
    border-left: 3px solid #b00020;
}

/* ==========================================
   DRUG CARD
   ========================================== */
.ddc-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.ddc-drug-title {
    margin: 0 0 8px;
    font-size: 1.35em;
    color: #222;
    line-height: 1.3;
}

.ddc-lat {
    font-weight: normal;
    color: #666;
    font-size: 0.9em;
    font-style: italic;
}

.ddc-form {
    color: #555;
    margin: 0 0 12px;
    font-size: 0.95em;
}

/* Предупреждения */
.ddc-warnings {
    margin: 12px 0;
    padding: 12px 15px;
    background: #fff8f0;
    border-left: 4px solid #ff9800;
    border-radius: 4px;
    font-size: 0.95em;
}

.ddc-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.9em;
    margin: 3px 0;
    line-height: 1.3;
}

.ddc-lethal {
    color: #b00020;
    background: #ffebee;
    border: 1px solid #b00020;
}

.ddc-conditional {
    color: #e65100;
    background: #fff3e0;
    border: 1px solid #e65100;
}

/* Симптомы и описание */
.ddc-symptoms,
.ddc-desc {
    margin-top: 14px;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    line-height: 1.5;
    font-size: 0.95em;
}

.ddc-symptoms strong {
    color: #c62828;
    display: block;
    margin-bottom: 6px;
}

.ddc-desc strong {
    color: #0d47a1;
    display: block;
    margin-bottom: 6px;
}

/* ==========================================
   AUTOCOMPLETE SUGGESTIONS
   ========================================== */
.ddc-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #189589;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    margin-top: 2px;
}

.ddc-suggestion-item {
    padding: 11px 16px;
    cursor: pointer;
    font-size: 0.95em;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s, color 0.15s;
    color: #333;
}

.ddc-suggestion-item:last-child {
    border-bottom: none;
}

.ddc-suggestion-item:hover,
.ddc-suggestion-item.active {
    background: #f0f8f7;
    color: #189589;
    font-weight: 500;
}

.ddc-suggestion-possible {
    padding: 12px 16px;
    background: #fff8f0;
    color: #e65100;
    font-size: 0.9em;
    border-bottom: none;
    font-weight: 500;
}

.ddc-suggestion-possible strong {
    color: #b00020;
    font-weight: 700;
}

/* ==========================================
   AUTHORITATIVE SOURCES
   ========================================== */
.ddc-sources {
    margin-top: 35px;
    padding: 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.92em;
}

.ddc-sources h3 {
    margin: 0 0 15px 0;
    font-size: 1.15em;
    color: #189589;
    font-weight: 600;
    border-bottom: 2px solid #189589;
    padding-bottom: 10px;
}

.ddc-sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 18px;
}

.ddc-source-group h4 {
    margin: 0 0 10px 0;
    font-size: 1em;
    color: #333 !important;
    font-weight: 600;
}

.ddc-source-group ul {
    margin: 0;
    padding-left: 18px;
    list-style: disc;
}

.ddc-source-group li {
    margin-bottom: 6px;
    line-height: 1.4;
}

.ddc-source-group a {
    color: #189589;
    text-decoration: none;
    transition: color 0.2s;
    word-break: break-word;
}

.ddc-source-group a:hover {
    color: #147a6f;
    text-decoration: underline;
}

.ddc-sources-note {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px dashed #cbd5e1;
    color: #64748b;
    font-style: italic;
    line-height: 1.4;
}

/* ==========================================
   MOBILE ADAPTIVE (≤ 480px)
   ========================================== */
@media (max-width: 480px) {
    .ddc-container {
        margin: 15px;
        padding: 18px 16px;
    }

    .ddc-container h2 {
        font-size: 1.5em;
        margin-bottom: 12px;
    }

    .ddc-db-stats {
        font-size: 0.9em;
        padding: 9px 12px;
    }

    .ddc-db-stats strong {
        font-size: 1.1em;
    }

    #ddc-drug-input {
        font-size: 1.05em;
        padding: 11px 13px;
    }

    .ddc-agree-label {
        font-size: 0.88em;
        gap: 8px;
    }

    #ddc-submit-btn {
        padding: 13px 18px;
        font-size: 1em;
    }

    .ddc-drug-title {
        font-size: 1.2em;
    }

    .ddc-lat {
        font-size: 0.88em;
        display: block;
        margin-top: 3px;
    }

    .ddc-badge {
        font-size: 0.88em;
        padding: 4px 8px;
    }

    .ddc-symptoms,
    .ddc-desc {
        font-size: 0.92em;
        padding: 10px 12px;
    }

    .ddc-suggestions {
        max-height: 180px;
        font-size: 0.92em;
    }

    .ddc-suggestion-item {
        padding: 10px 14px;
    }

    .ddc-sources {
        padding: 16px;
        font-size: 0.9em;
    }

    .ddc-sources h3 {
        font-size: 1.1em;
        padding-bottom: 8px;
    }

    .ddc-sources-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .ddc-source-group ul {
        padding-left: 16px;
    }
}

/* ==========================================
   EXTRA SMALL (≤ 360px) — Very compact phones
   ========================================== */
@media (max-width: 360px) {
    .ddc-container {
        margin: 10px;
        padding: 15px 12px;
    }

    .ddc-container h2 {
        font-size: 1.4em;
    }

    #ddc-drug-input {
        font-size: 1em;
    }

    .ddc-agree-label {
        font-size: 0.85em;
    }

    .ddc-drug-title {
        font-size: 1.15em;
    }

    .ddc-badge {
        display: block;
        width: fit-content;
    }
}

/* ==========================================
   ACCESSIBILITY & FOCUS
   ========================================== */
.ddc-container *:focus {
    outline: 2px solid #189589;
    outline-offset: 2px;
}

.ddc-container a:focus {
    outline-offset: 4px;
}

/* Screen reader only */
.ddc-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================
   PRINT STYLES
   ========================================== */
@media print {
    .ddc-container {
        border: 1px solid #000;
        padding: 10px;
        margin: 0;
        max-width: 100%;
    }

    #ddc-search-form,
    #ddc-submit-btn,
    .ddc-agree-wrapper,
    .ddc-sources {
        display: none;
    }

    .ddc-card {
        border: 1px solid #000;
        box-shadow: none;
    }
}