/* ============================================
   REUSABLE COMPONENT STYLES
   Warm Professional Theme - iOS 26 Flat Design
   ============================================ */

/* Navigation */
.nav-header {
    background: var(--bg-card, #ffffff);
    padding: 1rem 2rem;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(139, 115, 85, 0.06));
    margin-bottom: var(--spacing-xl, 2rem);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--warm-border, #f0ebe3);
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--warm-accent-dark, #6d5a42);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: var(--spacing-lg, 1.5rem);
    align-items: center;
}

.nav-link {
    color: var(--text-secondary, #5a4a3a);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md, 16px);
    transition: all 150ms ease;
}

.nav-link:hover,
.nav-link.active {
    background: var(--warm-subtle, #f5f2ee);
    color: var(--warm-accent-dark, #6d5a42);
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--warm-accent, #8b7355);
    text-decoration: none;
    font-weight: 500;
    margin-bottom: var(--spacing-lg, 1.5rem);
    transition: all 150ms ease;
}

.back-button:hover {
    color: var(--warm-accent-dark, #6d5a42);
    transform: translateX(-5px);
}

/* Progress Bars */
.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--warm-border, #f0ebe3);
    border-radius: var(--radius-md, 16px);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--warm-accent, #8b7355);
    border-radius: var(--radius-md, 16px);
    transition: width 300ms ease;
}

.progress-fill.success {
    background: var(--success-color, #10b981);
}

.progress-fill.warning {
    background: var(--warning-color, #f59e0b);
}

.progress-fill.danger {
    background: var(--danger-color, #ef4444);
}

/* Summary Rows */
.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md, 1rem);
    background: var(--warm-subtle, #f5f2ee);
    border-radius: var(--radius-md, 16px);
    margin-bottom: var(--spacing-md, 1rem);
}

.summary-row span:first-child {
    font-weight: 500;
    color: var(--text-secondary, #5a4a3a);
}

.summary-row span:last-child {
    font-weight: 600;
    color: var(--text-primary, #2c2c2c);
}

/* Sliders */
.slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--warm-border, #f0ebe3);
    border-radius: 3px;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--warm-accent, #8b7355);
    border-radius: 50%;
    cursor: pointer;
    transition: background 150ms ease;
}

.slider::-webkit-slider-thumb:hover {
    background: var(--warm-accent-dark, #6d5a42);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--warm-accent, #8b7355);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Timeline Components */
.timeline-container {
    background: var(--bg-card, #ffffff);
    border-radius: var(--radius-xl, 20px);
    padding: var(--spacing-xl, 2rem);
    margin-top: var(--spacing-xl, 2rem);
    border: 1px solid var(--warm-border, #f0ebe3);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(139, 115, 85, 0.06));
}

.timeline-header {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-lg, 1.5rem);
    color: var(--text-primary, #2c2c2c);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Metric Cards */
.metric-card {
    padding: var(--spacing-lg, 1.5rem);
    border-radius: var(--radius-lg, 18px);
    background: var(--warm-subtle, #f5f2ee);
    border: 1px solid var(--warm-border, #f0ebe3);
}

.metric-label {
    font-size: 0.875rem;
    color: var(--text-secondary, #5a4a3a);
    margin-bottom: var(--spacing-sm, 0.5rem);
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #2c2c2c);
}

.metric-unit {
    font-size: 0.875rem;
    color: var(--text-secondary, #5a4a3a);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-primary {
    background: var(--warm-subtle, #f5f2ee);
    color: var(--warm-accent-dark, #6d5a42);
}

.badge-success {
    background: var(--success-bg, #d1fae5);
    color: var(--success-text, #065f46);
}

.badge-danger {
    background: var(--danger-bg, #fee2e2);
    color: var(--danger-text, #991b1b);
}

.badge-warning {
    background: var(--warning-bg, #fef3c7);
    color: #d97706;
}

.badge-gold {
    background: var(--gold, #c9a96e);
    color: white;
}

/* Tooltips */
.tooltip {
    position: absolute;
    background: var(--text-primary, #2c2c2c);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md, 16px);
    font-size: 0.75rem;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 200ms ease;
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(139, 115, 85, 0.12));
}

.tooltip.visible {
    opacity: 1;
}

/* Collapsible Sections */
.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: var(--spacing-md, 1rem);
    background: var(--warm-subtle, #f5f2ee);
    border-radius: var(--radius-md, 16px);
    transition: background 150ms ease;
}

.collapsible-header:hover {
    background: var(--warm-border, #f0ebe3);
}

.collapsible-content {
    margin-top: var(--spacing-lg, 1.5rem);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--spacing-lg, 1.5rem);
}

.table th {
    background: var(--warm-subtle, #f5f2ee);
    padding: var(--spacing-md, 1rem);
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary, #2c2c2c);
    border-bottom: 2px solid var(--warm-border, #f0ebe3);
}

.table td {
    padding: var(--spacing-md, 1rem);
    border-bottom: 1px solid var(--warm-border, #f0ebe3);
    font-size: 0.875rem;
}

.table tr:hover {
    background: var(--warm-subtle, #f5f2ee);
}

/* App View Container */
#app {
    min-height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
}

.module-container {
    animation: fadeIn 300ms ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Navigation */
@media (max-width: 768px) {
    .nav-header {
        flex-direction: column;
        gap: var(--spacing-md, 1rem);
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ============================================
   PHASE 2 COMPONENTS - Missing UI Elements
   ============================================ */

/* Form Validation UI */
.form-error {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.375rem;
    color: var(--danger-color, #ef4444);
    font-size: 0.8125rem;
    line-height: 1.4;
}

.form-error svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.form-success {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.375rem;
    color: var(--success-color, #10b981);
    font-size: 0.8125rem;
    line-height: 1.4;
}

.form-success svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.form-helper-text {
    display: block;
    margin-top: 0.375rem;
    color: var(--text-secondary, #5a4a3a);
    font-size: 0.8125rem;
    line-height: 1.4;
}

.input-with-icon {
    position: relative;
}

.input-with-icon .form-control {
    padding-right: 2.5rem;
}

.input-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    pointer-events: none;
}

.input-icon.icon-success {
    color: var(--success-color, #10b981);
}

.input-icon.icon-error {
    color: var(--danger-color, #ef4444);
}

.form-control.is-valid {
    border-color: var(--success-color, #10b981);
}

.form-control.is-invalid {
    border-color: var(--danger-color, #ef4444);
}

/* Loading Skeletons */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--warm-border, #f0ebe3) 0%,
        var(--warm-subtle, #f5f2ee) 50%,
        var(--warm-border, #f0ebe3) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md, 16px);
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    height: 200px;
    width: 100%;
}

.skeleton-row {
    height: 60px;
    width: 100%;
    margin-bottom: 0.5rem;
}

.skeleton-text {
    height: 1rem;
    width: 100%;
    margin-bottom: 0.5rem;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-text.long {
    width: 90%;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

/* File Upload Component */
.file-upload-zone {
    border: 2px dashed var(--warm-border, #f0ebe3);
    border-radius: var(--radius-lg, 18px);
    padding: 2rem;
    text-align: center;
    background: var(--warm-subtle, #f5f2ee);
    transition: all 200ms ease;
    cursor: pointer;
}

.file-upload-zone:hover {
    border-color: var(--warm-accent, #8b7355);
    background: var(--bg-card, #ffffff);
}

.file-upload-zone.drag-over {
    border-color: var(--warm-accent, #8b7355);
    background: var(--bg-card, #ffffff);
    border-style: solid;
}

.file-upload-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    color: var(--text-secondary, #5a4a3a);
}

.file-upload-text {
    color: var(--text-primary, #2c2c2c);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.file-upload-hint {
    color: var(--text-secondary, #5a4a3a);
    font-size: 0.875rem;
}

.file-upload-input {
    display: none;
}

.file-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.file-preview-card {
    position: relative;
    border: 1px solid var(--warm-border, #f0ebe3);
    border-radius: var(--radius-md, 16px);
    padding: 0.75rem;
    background: var(--bg-card, #ffffff);
}

.file-preview-image {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-sm, 12px);
    margin-bottom: 0.5rem;
}

.file-preview-name {
    font-size: 0.75rem;
    color: var(--text-primary, #2c2c2c);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-preview-remove {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: var(--bg-card, #ffffff);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(139, 115, 85, 0.06));
    color: var(--text-secondary, #5a4a3a);
    transition: all 150ms ease;
}

.file-preview-remove:hover {
    background: var(--danger-color, #ef4444);
    color: white;
}

.upload-progress {
    height: 4px;
    background: var(--warm-border, #f0ebe3);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.upload-progress-bar {
    height: 100%;
    background: var(--warm-accent, #8b7355);
    transition: width 300ms ease;
}

/* Stepper/Wizard Component */
.stepper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    position: relative;
}

.stepper::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--warm-border, #f0ebe3);
    z-index: 0;
}

.stepper-progress {
    position: absolute;
    top: 20px;
    left: 0;
    height: 2px;
    background: var(--warm-accent, #8b7355);
    transition: width 400ms ease;
    z-index: 1;
}

.stepper-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
    z-index: 2;
}

.stepper-step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card, #ffffff);
    border: 2px solid var(--warm-border, #f0ebe3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text-secondary, #5a4a3a);
    margin-bottom: 0.5rem;
    transition: all 200ms ease;
}

.stepper-step.active .stepper-step-circle {
    background: var(--warm-accent, #8b7355);
    border-color: var(--warm-accent, #8b7355);
    color: white;
    transform: scale(1.1);
}

.stepper-step.completed .stepper-step-circle {
    background: var(--success-color, #10b981);
    border-color: var(--success-color, #10b981);
    color: white;
}

.stepper-step.completed .stepper-step-circle::before {
    content: '\2713';
}

.stepper-step.completed .stepper-step-circle {
    font-size: 0;
}

.stepper-step.completed .stepper-step-circle::before {
    font-size: 1rem;
}

.stepper-step-label {
    font-size: 0.875rem;
    color: var(--text-secondary, #5a4a3a);
    font-weight: 500;
    text-align: center;
}

.stepper-step.active .stepper-step-label {
    color: var(--text-primary, #2c2c2c);
    font-weight: 700;
}

.stepper-step.completed .stepper-step-label {
    color: var(--success-color, #10b981);
}

/* Breadcrumb Navigation */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary, #5a4a3a);
}

.breadcrumb-item a {
    color: var(--warm-accent, #8b7355);
    text-decoration: none;
    transition: color 150ms ease;
}

.breadcrumb-item a:hover {
    color: var(--warm-accent-dark, #6d5a42);
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: var(--text-primary, #2c2c2c);
    font-weight: 500;
}

.breadcrumb-separator {
    color: var(--text-secondary, #5a4a3a);
    user-select: none;
}

/* Enhanced Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card, #ffffff);
    border-radius: var(--radius-lg, 18px);
    overflow: hidden;
    box-shadow: var(--shadow-md, 0 2px 8px rgba(139, 115, 85, 0.08));
}

.data-table thead {
    background: var(--warm-subtle, #f5f2ee);
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary, #2c2c2c);
    font-size: 0.875rem;
    border-bottom: 2px solid var(--warm-border, #f0ebe3);
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 150ms ease;
}

.data-table th.sortable:hover {
    background: var(--warm-border, #f0ebe3);
}

.data-table th.sortable::after {
    content: '\21C5';
    margin-left: 0.5rem;
    color: var(--text-secondary, #5a4a3a);
}

.data-table th.sortable.asc::after {
    content: '\2191';
    color: var(--warm-accent, #8b7355);
}

.data-table th.sortable.desc::after {
    content: '\2193';
    color: var(--warm-accent, #8b7355);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--warm-border, #f0ebe3);
    color: var(--text-primary, #2c2c2c);
    font-size: 0.875rem;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr {
    transition: background 150ms ease;
}

.data-table tbody tr:hover {
    background: var(--warm-subtle, #f5f2ee);
}

.data-table tbody tr.selected {
    background: var(--warm-subtle, #f5f2ee);
    border-left: 3px solid var(--warm-accent, #8b7355);
}

.table-search {
    margin-bottom: 1rem;
    position: relative;
}

.table-search input {
    width: 100%;
    padding: 0.625rem 2.5rem 0.625rem 1rem;
    border: 1px solid var(--warm-border, #f0ebe3);
    border-radius: var(--radius-md, 16px);
    font-size: 0.875rem;
    background: var(--bg-card, #ffffff);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.table-search input:focus {
    outline: none;
    border-color: var(--warm-accent, #8b7355);
    box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.1);
}

.table-search-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary, #5a4a3a);
    width: 1.25rem;
    height: 1.25rem;
}

.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-card, #ffffff);
    border-radius: var(--radius-md, 16px);
    border: 1px solid var(--warm-border, #f0ebe3);
}

.table-pagination-info {
    color: var(--text-secondary, #5a4a3a);
    font-size: 0.875rem;
}

.table-pagination-controls {
    display: flex;
    gap: 0.5rem;
}

.table-pagination-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--warm-border, #f0ebe3);
    background: var(--bg-card, #ffffff);
    border-radius: var(--radius-sm, 12px);
    cursor: pointer;
    transition: all 150ms ease;
    font-size: 0.875rem;
}

.table-pagination-btn:hover:not(:disabled) {
    background: var(--warm-subtle, #f5f2ee);
    border-color: var(--warm-accent, #8b7355);
}

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

.table-pagination-btn.active {
    background: var(--warm-accent, #8b7355);
    color: white;
    border-color: var(--warm-accent, #8b7355);
}

/* Row Selection */
.table-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--warm-accent, #8b7355);
}

/* Responsive Tables */
@media (max-width: 768px) {
    .data-table {
        font-size: 0.8125rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
    }

    .table-pagination {
        flex-direction: column;
        gap: 1rem;
    }
}
