/* OrthoPlan Pro – frontend (doctor / lab / login) styles */

:root {
    --op-primary: #6366f1;
    --op-primary-hover: #4f46e5;
    --op-bg: #f9fafb;
    --op-card: #ffffff;
    --op-border: #e5e7eb;
    --op-text: #111827;
    --op-muted: #6b7280;
    --op-success: #10b981;
    --op-warning: #f59e0b;
    --op-danger:  #ef4444;
    --op-radius: 10px;
    --op-shadow: 0 1px 3px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.06);
    --op-shadow-md: 0 4px 6px rgba(0,0,0,.05), 0 2px 4px rgba(0,0,0,.06);
}

.op-frontend {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--op-text);
    line-height: 1.5;
}
.op-frontend h1, .op-frontend h2, .op-frontend h3, .op-frontend h4 {
    color: var(--op-text);
    margin: 0 0 12px;
}
.op-frontend h1 { font-size: 28px; }
.op-frontend h2 { font-size: 22px; }
.op-frontend h3 { font-size: 18px; }
.op-frontend p  { margin: 0 0 12px; }
.op-frontend a  { color: var(--op-primary); text-decoration: none; }
.op-frontend a:hover { text-decoration: underline; }

.op-page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}
.op-page-head h1 { margin: 0; }
.op-page-actions { display: flex; gap: 8px; }
.op-back-link { font-size: 13px; color: var(--op-muted); }

.op-card {
    background: var(--op-card);
    border: 1px solid var(--op-border);
    border-radius: var(--op-radius);
    padding: 20px 22px;
    margin-bottom: 16px;
    box-shadow: var(--op-shadow);
}
.op-muted { color: var(--op-muted); font-size: 13px; }

/* Buttons */
.op-btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    background: #fff;
    color: var(--op-text);
    border: 1px solid var(--op-border);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all .15s ease;
    text-decoration: none !important;
    line-height: 1.2;
}
.op-btn:hover { background: #f3f4f6; }
.op-btn-primary { background: var(--op-primary); color: #fff; border-color: var(--op-primary); }
.op-btn-primary:hover { background: var(--op-primary-hover); border-color: var(--op-primary-hover); color:#fff; }
.op-btn-warning { background: var(--op-warning); color: #fff; border-color: var(--op-warning); }
.op-btn-warning:hover { background: #d97706; }
.op-btn-block   { display: block; width: 100%; text-align: center; }
.op-btn-small   { padding: 5px 10px; font-size: 12px; }

/* Forms */
.op-frontend label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 12px;
    color: #374151;
}
.op-frontend input[type="text"],
.op-frontend input[type="email"],
.op-frontend input[type="tel"],
.op-frontend input[type="password"],
.op-frontend input[type="number"],
.op-frontend input[type="date"],
.op-frontend select,
.op-frontend textarea {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 8px 10px;
    border: 1px solid var(--op-border);
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    color: var(--op-text);
    box-sizing: border-box;
}
.op-frontend textarea { font-family: inherit; resize: vertical; }
.op-frontend input:focus,
.op-frontend select:focus,
.op-frontend textarea:focus {
    outline: 2px solid var(--op-primary);
    outline-offset: -1px;
    border-color: var(--op-primary);
}
.op-frontend label.op-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.op-frontend label.op-inline input[type="checkbox"] {
    width: auto;
    margin: 0;
}
.op-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}
.op-form-grid-full { grid-column: 1 / -1; }

.op-info-table { width: 100%; }
.op-info-table th { text-align: left; color: var(--op-muted); padding: 6px 0; font-weight: 500; width: 130px; }
.op-info-table td { padding: 6px 0; }

/* Auth */
.op-auth { max-width: 460px; }
.op-auth-tabs {
    display: flex;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 18px;
}
.op-auth-tabs a {
    flex: 1;
    text-align: center;
    padding: 8px;
    color: var(--op-muted);
    border-radius: 6px;
    font-weight: 500;
}
.op-auth-tabs a.active {
    background: #fff;
    color: var(--op-text);
    box-shadow: var(--op-shadow);
}
.op-auth-form { padding: 28px; }

/* Alerts */
.op-alert {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 14px;
}
.op-alert-error   { background: #fef2f2; color: #991b1b; border-left: 4px solid var(--op-danger); }
.op-alert-success { background: #ecfdf5; color: #065f46; border-left: 4px solid var(--op-success); }
.op-alert-warning { background: #fffbeb; color: #92400e; border-left: 4px solid var(--op-warning); }

#op-message:not(:empty) {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 12px;
    background: #ecfdf5;
    color: #065f46;
    border-left: 4px solid var(--op-success);
}
#op-message.op-error {
    background: #fef2f2;
    color: #991b1b;
    border-left-color: var(--op-danger);
}

/* Badges */
.op-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 500;
    background: #f3f4f6;
    color: #374151;
}
.op-color-gray   { background: #f3f4f6; color: #374151; border-left: 3px solid #6b7280; }
.op-color-blue   { background: #dbeafe; color: #1e40af; }
.op-color-red    { background: #fee2e2; color: #991b1b; }
.op-color-amber  { background: #fef3c7; color: #92400e; }
.op-color-green  { background: #d1fae5; color: #065f46; }
.op-color-purple { background: #ede9fe; color: #5b21b6; }
.op-color-coral  { background: #ffe4e6; color: #9f1239; }
.op-color-teal   { background: #ccfbf1; color: #134e4a; }

.op-status-pending  { background: #fef3c7; color: #92400e; }
.op-status-paid     { background: #d1fae5; color: #065f46; }
.op-status-refunded { background: #e0e7ff; color: #3730a3; }
.op-status-void     { background: #f3f4f6; color: #6b7280; }

/* Case grid */
.op-case-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.op-case-card {
    display: block;
    background: var(--op-card);
    border: 1px solid var(--op-border);
    border-radius: var(--op-radius);
    padding: 16px 18px;
    box-shadow: var(--op-shadow);
    text-decoration: none !important;
    color: var(--op-text);
    transition: box-shadow .2s ease, transform .15s ease;
}
.op-case-card:hover { box-shadow: var(--op-shadow-md); transform: translateY(-1px); }
.op-case-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.op-case-code {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
    color: var(--op-muted);
}
.op-case-name { font-size: 16px; margin: 4px 0 6px; color: var(--op-text); }
.op-case-meta { font-size: 12px; color: var(--op-muted); margin-bottom: 8px; }

/* Empty state */
.op-empty { text-align: center; padding: 40px 20px; }
.op-empty-icon { font-size: 48px; margin-bottom: 12px; }
.op-empty h3 { margin-bottom: 6px; }

/* Progress */
.op-progress {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}
.op-progress-large { height: 10px; }
.op-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--op-primary), var(--op-success));
    transition: width .4s ease;
}

/* Timeline */
.op-timeline-card { padding: 16px 18px; }
.op-timeline {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 10px;
    overflow-x: auto;
}
.op-tl-step {
    flex: 1;
    text-align: center;
    min-width: 70px;
    position: relative;
}
.op-tl-dot {
    width: 14px;
    height: 14px;
    background: #e5e7eb;
    border-radius: 50%;
    margin: 0 auto 6px;
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px #e5e7eb;
}
.op-tl-step.op-tl-done .op-tl-dot {
    background: var(--op-primary);
    box-shadow: 0 0 0 1px var(--op-primary);
}
.op-tl-label {
    font-size: 11px;
    color: var(--op-muted);
}
.op-tl-step.op-tl-done .op-tl-label { color: var(--op-text); font-weight: 500; }

/* Tabs */
.op-tabs-wrapper { margin-top: 8px; }
.op-tabs-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    border-bottom: 1px solid var(--op-border);
    margin-bottom: 14px;
}
.op-tab-link {
    padding: 10px 14px;
    font-size: 14px;
    color: var(--op-muted);
    border-bottom: 2px solid transparent;
    text-decoration: none !important;
    transition: all .15s ease;
}
.op-tab-link:hover { color: var(--op-text); }
.op-tab-link.active { color: var(--op-primary); border-bottom-color: var(--op-primary); font-weight: 500; }

.op-tab-panel { display: none; }
.op-tab-panel.active { display: block; }

/* Sections (collapsible) */
.op-section {
    background: #f9fafb;
    border: 1px solid var(--op-border);
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 10px;
}
.op-section summary { cursor: pointer; padding: 4px 0; user-select: none; }
.op-section[open] summary { margin-bottom: 8px; }

/* Photos */
.op-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.op-photo-slot {
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 10px;
    background: #f9fafb;
    text-align: center;
}
.op-photo-slot-label {
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 8px;
    min-height: 30px;
}
.op-photo-thumb {
    position: relative;
    margin-bottom: 6px;
}
.op-photo-thumb img {
    max-width: 100%;
    max-height: 130px;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
.op-photo-thumb .op-delete-att {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(239,68,68,.9);
    color: #fff;
    border: 0;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    cursor: pointer;
    font-weight: 700;
    line-height: 1;
}
.op-photo-empty {
    color: #9ca3af;
    font-size: 12px;
    margin-bottom: 8px;
}
.op-upload-input { width: 100%; font-size: 11px; }
.op-file-icon { color: var(--op-primary); }

/* Tables */
.op-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
}
.op-table th, .op-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--op-border);
    font-size: 13px;
}
.op-table th {
    font-weight: 600;
    background: #f9fafb;
    color: var(--op-muted);
}

/* Payments summary */
.op-pay-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.op-pay-card {
    background: #f9fafb;
    border: 1px solid var(--op-border);
    border-radius: 8px;
    padding: 14px 16px;
}
.op-pay-label { font-size: 12px; color: var(--op-muted); }
.op-pay-amount { font-size: 22px; font-weight: 600; margin: 4px 0; }
.op-pay-paid { font-size: 13px; color: #374151; }
.op-pay-due { color: var(--op-warning); font-weight: 500; margin-top: 4px; font-size: 13px; }
.op-pay-done { color: var(--op-success); font-weight: 500; margin-top: 4px; font-size: 13px; }

/* Stage list (lab) */
.op-stage-list { list-style: none; padding: 0; margin: 0; }
.op-stage {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9fafb;
    border: 1px solid var(--op-border);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}
.op-stage-completed  { background: #ecfdf5; border-color: #6ee7b7; }
.op-stage-in_progress{ background: #fef3c7; border-color: #fcd34d; }
.op-stage-skipped    { background: #f3f4f6; opacity: 0.6; }
.op-stage-info strong { font-size: 14px; }
.op-stage-status {
    margin-left: 8px;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--op-muted);
    letter-spacing: 0.4px;
}
.op-stage-info small { color: var(--op-muted); margin-left: 8px; }
.op-stage-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Lab case header */
.op-lab-case-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}
.op-lab-case-head h3 { margin: 6px 0 0; }
.op-lab-shipping {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px dashed var(--op-border);
}
.op-lab-shipping h4 { font-size: 14px; }

/* Activity */
.op-activity-list { list-style: none; padding: 0; }
.op-activity-list li {
    padding: 8px 0;
    border-bottom: 1px dashed var(--op-border);
    font-size: 13px;
}
.op-activity-when { color: var(--op-muted); margin-right: 6px; }
.op-activity-user { font-weight: 600; margin-right: 4px; }

/* Design review */
.op-design-item { margin-bottom: 16px; }
.op-design-actions {
    margin-top: 16px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Mobile tweaks */
@media (max-width: 640px) {
    .op-frontend { padding: 14px 10px; }
    .op-frontend h1 { font-size: 22px; }
    .op-page-head { flex-direction: column; align-items: stretch; }
    .op-tab-link { padding: 8px 10px; font-size: 13px; }
    .op-photo-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .op-stage { flex-direction: column; align-items: flex-start; }
    .op-stage-actions { width: 100%; }
}

/* RTL support */
.op-frontend[dir="rtl"], body.rtl .op-frontend {
    direction: rtl;
}
body.rtl .op-color-gray,
body.rtl .op-color-blue,
body.rtl .op-color-red,
body.rtl .op-color-amber,
body.rtl .op-color-green,
body.rtl .op-color-purple,
body.rtl .op-color-coral,
body.rtl .op-color-teal {
    border-right-width: 3px;
    border-right-style: solid;
    border-left: 0;
}
