/* =============================================
   Prescription AI – Front-End Styles
   ============================================= */

.pai-wrapper {
    max-width: 700px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1a1a2e;
}

/* ---- Form wrap ---- */
.pai-form-wrap {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
}

.pai-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pai-subtitle {
    color: #666;
    margin: 0 0 28px;
    font-size: .95rem;
    line-height: 1.6;
}

/* ---- Fields ---- */
.pai-field {
    margin-bottom: 22px;
}

.pai-field label {
    display: block;
    font-weight: 600;
    font-size: .9rem;
    margin-bottom: 8px;
    color: #333;
}

.pai-req { color: #e74c3c; }

.pai-field input[type="email"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color .2s;
    box-sizing: border-box;
}

.pai-field input[type="email"]:focus {
    border-color: #6c63ff;
    outline: none;
}

/* ---- Dropzone ---- */
.pai-dropzone {
    position: relative;
    border: 2px dashed #c5cae9;
    border-radius: 12px;
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    background: #fafbff;
}

.pai-dropzone:hover,
.pai-dropzone.dragover {
    border-color: #6c63ff;
    background: #f3f0ff;
}

.pai-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.pai-dropzone-icon { font-size: 2.5rem; display: block; }
.pai-dropzone-ui p { margin: 6px 0; font-size: .9rem; color: #555; }
.pai-hint { color: #999; font-size: .8rem !important; }

.pai-file-preview {
    font-size: .9rem;
    color: #4a4a8a;
    font-weight: 600;
}

/* ---- Disclaimer ---- */
.pai-disclaimer {
    font-size: .8rem;
    color: #888;
    background: #fef9e7;
    border-left: 3px solid #f39c12;
    padding: 10px 14px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 22px;
    line-height: 1.5;
}

/* ---- Button ---- */
.pai-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #6c63ff, #48c6ef);
    color: #fff;
    border: none;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .2s, transform .1s;
    width: 100%;
    justify-content: center;
}

.pai-btn:hover { opacity: .92; transform: translateY(-1px); }
.pai-btn:active { transform: translateY(0); }
.pai-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.pai-btn--outline {
    background: transparent;
    border: 2px solid #6c63ff;
    color: #6c63ff;
    width: auto;
    padding: 10px 20px;
    font-size: .9rem;
}

/* ---- Spinner ---- */
.pai-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pai-spin .7s linear infinite;
}

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

/* ---- Error ---- */
.pai-error {
    margin-top: 12px;
    background: #fdecea;
    border-left: 4px solid #e74c3c;
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    font-size: .9rem;
    color: #c0392b;
}

/* ---- Results ---- */
.pai-results {
    animation: pai-fadeIn .4s ease;
}

@keyframes pai-fadeIn { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:none; } }

.pai-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.pai-results-header h2 {
    font-size: 1.4rem;
    margin: 0;
}

/* ---- Cards ---- */
.pai-card {
    background: #fff;
    border-radius: 14px;
    padding: 24px 28px;
    margin-bottom: 18px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

.pai-card h3 {
    margin: 0 0 16px;
    font-size: 1.05rem;
    color: #3d3d6b;
    border-bottom: 2px solid #f0f0f8;
    padding-bottom: 10px;
}

.pai-card--warning {
    border-left: 4px solid #e67e22;
}

/* ---- Medicine items ---- */
.pai-medicine {
    background: #f8f7ff;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 12px;
}

.pai-medicine-name {
    font-weight: 700;
    font-size: 1rem;
    color: #2c2c6c;
    margin-bottom: 6px;
}

.pai-medicine-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pai-badge {
    font-size: .78rem;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
}

.pai-badge--dosage    { background: #e8f5e9; color: #2e7d32; }
.pai-badge--frequency { background: #e3f2fd; color: #1565c0; }
.pai-badge--duration  { background: #fff3e0; color: #e65100; }

.pai-medicine-instructions {
    margin-top: 8px;
    font-size: .85rem;
    color: #666;
    font-style: italic;
}

/* ---- Interaction items ---- */
.pai-interaction {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 4px solid #ccc;
}

.pai-interaction--mild     { border-color: #27ae60; background: #f0faf4; }
.pai-interaction--moderate { border-color: #f39c12; background: #fffbf0; }
.pai-interaction--severe   { border-color: #e74c3c; background: #fff5f5; }

.pai-interaction-drugs {
    font-weight: 700;
    font-size: .9rem;
    margin-bottom: 4px;
}

.pai-interaction-desc { font-size: .85rem; color: #555; }

.pai-severity {
    display: inline-block;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
}

.pai-severity--mild     { background: #d5f5e3; color: #1e8449; }
.pai-severity--moderate { background: #fdebd0; color: #d68910; }
.pai-severity--severe   { background: #fadbd8; color: #c0392b; }

/* ---- Warnings list ---- */
#pai-warnings-list {
    margin: 0;
    padding-left: 20px;
}

#pai-warnings-list li {
    margin-bottom: 6px;
    font-size: .9rem;
    line-height: 1.5;
}

/* ---- Responsive ---- */
@media (max-width: 500px) {
    .pai-form-wrap { padding: 24px 18px; }
    .pai-results-header { flex-direction: column; align-items: flex-start; }
}
