/* ==========================================================================
   Shared Components CSS
   Common styles used across multiple dashboard pages.
   Loaded globally via header.ejs to eliminate per-page duplication.
   ========================================================================== */

/* Page Padding (each page wraps content in a page-specific class) */
.orders-page,
.billing-page,
.deliveries-page,
.delivery-detail-page,
.messages-page,
.support-page,
.refills-page,
.prescriptions-page,
.pricing-page,
.home-page,
.profile-page {
    padding-bottom: 4rem;
}

/* ==========================================================================
   Page Header
   ========================================================================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 0.5rem 0;
}

.page-header .header-content p {
    color: #6b7280;
    margin: 0;
}

/* Header Stats Pill */
.header-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: linear-gradient(135deg, #136FD9 0%, #0d5aa8 100%);
    padding: 1rem 1.5rem;
    border-radius: 12px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

.stat-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-divider {
    width: 1px;
    height: 30px;
    background: rgba(255, 255, 255, 0.3);
}

/* Back Link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    transition: color 0.2s;
}

.back-link:hover {
    color: #136FD9;
}

/* ==========================================================================
   Content Sections
   ========================================================================== */
.content-section {
    margin-bottom: 2.5rem;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.section-title h2 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
    padding: 0;
    border: none;
}

.section-count {
    font-size: 0.8rem;
    color: #6b7280;
    background: #f3f4f6;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

/* ==========================================================================
   Alerts
   ========================================================================== */
.alert {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
}

.alert-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
}

.alert-content strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.alert-content p {
    font-size: 0.875rem;
    margin: 0;
}

.alert .btn {
    flex-shrink: 0;
}

/* Alert Variants */
.alert-success {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.alert-success .alert-icon {
    background: #d1fae5;
    color: #059669;
}

.alert-success svg {
    color: #10b981;
    flex-shrink: 0;
}

.alert-warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fde68a;
}

.alert-warning .alert-icon {
    background: #fef3c7;
    color: #d97706;
}

.alert-warning .alert-content strong { color: #92400e; }
.alert-warning .alert-content p { color: #b45309; }

.alert-danger {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fecaca;
}

.alert-danger .alert-icon {
    background: #fee2e2;
    color: #dc2626;
}

.alert-danger .alert-content strong { color: #991b1b; }
.alert-danger .alert-content p { color: #b91c1c; }

.alert-info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
}

.alert-info .alert-icon {
    background: #dbeafe;
    color: #2563eb;
}

.alert-info .alert-content {
    color: #1e40af;
}

/* ==========================================================================
   Status Badges
   ========================================================================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
}

.status-success { background: #d1fae5; color: #065f46; }
.status-warning { background: #fef3c7; color: #92400e; }
.status-danger { background: #fee2e2; color: #991b1b; }
.status-info { background: #dbeafe; color: #1e40af; }

/* Mini Badge (inline use in detail rows) */
.mini-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.mini-badge.success { background: #d1fae5; color: #065f46; }
.mini-badge.warning { background: #fef3c7; color: #92400e; }
.mini-badge.danger { background: #fee2e2; color: #991b1b; }
.mini-badge.info { background: #dbeafe; color: #1e40af; }

/* Status Pill (used in invoice tables) */
.status-pill {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
}

/* ==========================================================================
   Detail Row Pattern
   ========================================================================== */
.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f3f4f6;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 0.8rem;
    color: #6b7280;
}

.detail-value {
    font-size: 0.85rem;
    font-weight: 500;
    color: #374151;
}

.detail-value.highlight {
    color: #059669;
}

.detail-value.price {
    color: #059669;
    font-weight: 600;
}

.detail-value.success {
    color: #059669;
}

.detail-value.mono {
    font-family: monospace;
    font-size: 0.8rem;
}

.detail-value.amount {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}

/* ==========================================================================
   Detail Card (used on detail/show pages)
   ========================================================================== */
.detail-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border-bottom: 1px solid #f3f4f6;
}

.card-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0369a1;
}

.card-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 0.25rem 0;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1.25rem 1.5rem;
    background: #f9fafb;
    border-top: 1px solid #f3f4f6;
    display: flex;
    gap: 0.75rem;
}

/* ==========================================================================
   Info Grid (used in detail cards)
   ========================================================================== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-label {
    font-size: 0.8rem;
    color: #6b7280;
}

.info-value {
    font-size: 0.95rem;
    font-weight: 500;
    color: #111827;
}

.info-value.highlight {
    color: #059669;
}

/* ==========================================================================
   Quick Actions Card (help/CTA card pattern)
   ========================================================================== */
.quick-actions-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.qa-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0369a1;
    flex-shrink: 0;
}

.qa-content {
    flex: 1;
}

.qa-content h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 0.25rem 0;
}

.qa-content p {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

/* ==========================================================================
   Empty State
   ========================================================================== */
.empty-state {
    background: white;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    border: 1px dashed #d1d5db;
}

.empty-state.small {
    padding: 2rem;
}

.empty-state .empty-icon,
.empty-state .empty-state-icon {
    color: #9ca3af;
    margin-bottom: 1rem;
}

.empty-state .empty-state-icon {
    width: 80px;
    height: 80px;
    background: #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.empty-state h2,
.empty-state h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin: 0 0 0.5rem 0;
}

.empty-state h2 {
    font-size: 1.25rem;
}

.empty-state p {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0 0 1.5rem 0;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    border: none;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.btn-primary {
    background: linear-gradient(135deg, #136FD9 0%, #0d5aa8 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(19, 111, 217, 0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-outline {
    background: white;
    color: #136FD9;
    border: 1px solid #136FD9;
}

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

.btn-warning {
    background: #d97706;
    color: white;
    border: none;
}

.btn-warning:hover {
    background: #b45309;
}

.btn-danger {
    background: #dc2626;
    color: white;
    border: none;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-text {
    background: transparent;
    color: #6b7280;
    border: none;
}

.btn-text:hover {
    color: #dc2626;
    background: #fef2f2;
}

.btn-disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

/* ==========================================================================
   Pagination
   ========================================================================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.pagination-btn:hover:not(.disabled) {
    border-color: #136FD9;
    color: #136FD9;
}

.pagination-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 0.875rem;
    color: #6b7280;
}

/* ==========================================================================
   Form Styles
   ========================================================================== */
.form-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #111827;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #136FD9;
    box-shadow: 0 0 0 3px rgba(19, 111, 217, 0.1);
}

.form-control::placeholder {
    color: #9ca3af;
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

/* ==========================================================================
   Shared Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        gap: 1rem;
    }

    .header-stats {
        width: 100%;
        justify-content: center;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .card-footer {
        flex-direction: column;
    }

    .card-footer .btn {
        width: 100%;
    }

    .quick-actions-card {
        flex-direction: column;
        text-align: center;
    }

    .quick-actions-card .btn {
        width: 100%;
    }

    .alert {
        flex-direction: column;
        text-align: center;
    }

    .alert .btn {
        width: 100%;
        margin-top: 0.75rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}
