/* ============================================
   DENTAL VOICE PRO - MINIATURIZED COMPONENTS
   Using unified design system variables
   1/4 scale for compact, refined aesthetic
   ============================================ */

/* Glass-morphism Effects */
.glass {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Card Components - MINIATURIZED (1/4 scale) */
.card {
    background: var(--bg-lightest);  /* Soft background, not harsh white */
    border-radius: var(--radius-md);
    padding: var(--card-padding);    /* 0.75rem instead of 2-3rem */
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    border: 1px solid var(--border-light);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--border-medium);
}

/* Badge Components - COMPACT */
.badge-small {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-sm);  /* 0.25rem 0.5rem */
    border-radius: var(--radius-sm);
    font-size: var(--font-xs);    /* 0.75rem */
    font-weight: var(--font-semibold);
    line-height: 1;
}

.badge-primary {
    background: var(--color-primary);
    color: var(--bg-lightest);
}

.badge-success {
    background: var(--color-success);
    color: var(--bg-lightest);
}

.badge-warning {
    background: var(--color-warning);
    color: var(--bg-lightest);
}

.badge-error {
    background: var(--color-error);
    color: var(--bg-lightest);
}

/* Input Components - COMPACT */
.input-group {
    margin-bottom: var(--spacing-md);  /* 0.75rem */
}

.input-label {
    display: block;
    margin-bottom: var(--spacing-xs);  /* 0.25rem */
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    font-size: var(--font-sm);  /* 0.875rem */
}

.input-field {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);  /* 0.5rem 0.75rem */
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    font-size: var(--font-sm);  /* 0.875rem */
    background: var(--bg-lightest);
    color: var(--text-primary);
    transition: border-color var(--transition-fast);
}

.input-field:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 117, 255, 0.1);
}

.input-field:disabled {
    background: var(--bg-medium);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Select Components - COMPACT */
.select-field {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    font-size: var(--font-sm);
    background: var(--bg-lightest);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.select-field:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 117, 255, 0.1);
}

/* Checkbox Components - COMPACT */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.checkbox {
    width: 16px;  /* Miniaturized from 20px */
    height: 16px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

/* Modal Components - COMPACT OVERLAY SYSTEM */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 22, 40, 0.7);  /* Refined backdrop */
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--bg-lightest);
    border-radius: var(--radius-xl);
    max-width: 400px;  /* Miniaturized from 500px */
    width: 90%;
    max-height: 85vh;  /* Slightly reduced */
    overflow-y: auto;
    padding: var(--spacing-xl);  /* 1.5rem instead of 3rem */
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-light);
    transform: scale(0.95) translateY(20px);
    transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
}

.modal-title {
    font-size: var(--font-xl);  /* 1.5rem */
    color: var(--text-primary);
    font-weight: var(--font-bold);
    margin: 0;
}

.modal-close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background: none;
    border: none;
    font-size: var(--font-xl);
    cursor: pointer;
    color: var(--text-tertiary);
    transition: color var(--transition-fast);
    padding: var(--spacing-xs);
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
    font-size: var(--font-sm);
    line-height: var(--line-relaxed);
}

.modal-footer {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-light);
}

/* Alert Components - COMPACT */
.alert {
    padding: var(--spacing-md);  /* 0.75rem */
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    border-left: 3px solid;  /* Thinner border */
    font-size: var(--font-sm);
    line-height: var(--line-normal);
}

.alert-success {
    background: rgba(16, 185, 129, 0.08);
    border-color: var(--color-success);
    color: #065f46;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: var(--color-warning);
    color: #78350f;
}

.alert-error {
    background: rgba(239, 68, 68, 0.08);
    border-color: var(--color-error);
    color: #991b1b;
}

.alert-info {
    background: rgba(79, 117, 255, 0.08);
    border-color: var(--color-info);
    color: #1e3a8a;
}

/* Loading Spinner - MINIATURIZED */
.spinner {
    width: 32px;  /* Miniaturized from 40px */
    height: 32px;
    border: 3px solid var(--bg-medium);  /* Thinner */
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.spinner-small {
    width: 16px;  /* Miniaturized from 20px */
    height: 16px;
    border-width: 2px;
}

/* Progress Bar - COMPACT */
.progress-bar {
    width: 100%;
    height: 6px;  /* Thinner from 8px */
    background: var(--bg-medium);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--color-primary);
    transition: width var(--transition-base);
    border-radius: var(--radius-sm);
}

/* Tooltip - COMPACT */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip-text {
    visibility: hidden;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-dark);
    color: var(--text-on-dark);
    padding: var(--spacing-xs) var(--spacing-sm);  /* 0.25rem 0.5rem */
    border-radius: var(--radius-sm);
    font-size: var(--font-xs);  /* 0.75rem */
    white-space: nowrap;
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: var(--z-tooltip);
    box-shadow: var(--shadow-lg);
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Dropdown - COMPACT */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-lightest);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 160px;  /* Miniaturized from 200px */
    margin-top: var(--spacing-xs);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    z-index: var(--z-dropdown);
}

.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    padding: var(--spacing-sm) var(--spacing-md);  /* 0.5rem 0.75rem */
    cursor: pointer;
    transition: background var(--transition-fast);
    font-size: var(--font-sm);
    color: var(--text-primary);
}

.dropdown-item:hover {
    background: var(--bg-light);
}

.dropdown-item:first-child {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* Tabs - COMPACT */
.tabs {
    display: flex;
    gap: var(--spacing-sm);  /* 0.5rem */
    border-bottom: 1px solid var(--border-light);  /* Thinner */
    margin-bottom: var(--spacing-lg);
}

.tab {
    padding: var(--spacing-sm) var(--spacing-md);  /* 0.5rem 0.75rem */
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all var(--transition-fast);
    color: var(--text-tertiary);
    font-weight: var(--font-medium);
    font-size: var(--font-sm);
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeInUp 0.3s ease-out;
}

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

/* Accordion - COMPACT */
.accordion-item {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-sm);
    overflow: hidden;
    background: var(--bg-lightest);
}

.accordion-header {
    padding: var(--spacing-md);  /* 0.75rem */
    cursor: pointer;
    background: var(--bg-light);
    font-weight: var(--font-semibold);
    font-size: var(--font-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background var(--transition-fast);
    color: var(--text-primary);
}

.accordion-header:hover {
    background: var(--bg-medium);
}

.accordion-icon {
    transition: transform var(--transition-fast);
    font-size: var(--font-base);
    color: var(--text-tertiary);
}

.accordion-item.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-base);
}

.accordion-item.active .accordion-content {
    max-height: 500px;
}

.accordion-body {
    padding: var(--spacing-md);
    font-size: var(--font-sm);
    color: var(--text-secondary);
    line-height: var(--line-relaxed);
}

/* Breadcrumbs - COMPACT */
.breadcrumbs {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
    margin-bottom: var(--spacing-md);
    font-size: var(--font-sm);
}

.breadcrumb-item {
    color: var(--text-tertiary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumb-item:hover {
    color: var(--color-primary);
}

.breadcrumb-separator {
    color: var(--border-dark);
    font-size: var(--font-xs);
}

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: var(--font-semibold);
}

/* Stat Cards - MINIATURIZED (1/4 scale) */
.stat-card {
    background: var(--bg-lightest);
    padding: var(--spacing-lg);  /* 1rem instead of 2-3rem */
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    transition: all var(--transition-base);
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.stat-value {
    font-size: var(--font-3xl);  /* 2.5rem instead of 4rem */
    font-weight: var(--font-extrabold);
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
    line-height: var(--line-tight);
}

.stat-label {
    color: var(--text-tertiary);
    font-size: var(--font-xs);  /* 0.75rem */
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: var(--font-semibold);
}

.stat-change {
    font-size: var(--font-xs);
    margin-top: var(--spacing-xs);
    font-weight: var(--font-medium);
}

.stat-change.positive {
    color: var(--color-success);
}

.stat-change.negative {
    color: var(--color-error);
}

/* Timeline - COMPACT */
.timeline {
    position: relative;
    padding-left: var(--spacing-xl);
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-medium);
}

.timeline-item {
    position: relative;
    margin-bottom: var(--spacing-xl);
}

.timeline-marker {
    position: absolute;
    left: -22px;  /* Adjusted for smaller marker */
    width: 10px;  /* Miniaturized from 12px */
    height: 10px;
    border-radius: 50%;
    background: var(--color-primary);
    border: 2px solid var(--bg-lightest);
    box-shadow: 0 0 0 2px var(--color-primary);
}

.timeline-content {
    background: var(--bg-lightest);
    padding: var(--spacing-md);  /* 0.75rem */
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.timeline-date {
    font-size: var(--font-xs);
    color: var(--text-tertiary);
    margin-bottom: var(--spacing-xs);
    font-weight: var(--font-medium);
}

.timeline-title {
    font-size: var(--font-sm);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.timeline-description {
    font-size: var(--font-sm);
    color: var(--text-secondary);
    line-height: var(--line-normal);
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

/* Spacing Utilities - Using Miniaturized Scale */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--spacing-xs); }   /* 0.25rem */
.mt-2 { margin-top: var(--spacing-sm); }   /* 0.5rem */
.mt-3 { margin-top: var(--spacing-md); }   /* 0.75rem */
.mt-4 { margin-top: var(--spacing-lg); }   /* 1rem */
.mt-5 { margin-top: var(--spacing-xl); }   /* 1.5rem */
.mt-6 { margin-top: var(--spacing-2xl); }  /* 2rem */

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }
.mb-5 { margin-bottom: var(--spacing-xl); }
.mb-6 { margin-bottom: var(--spacing-2xl); }

.p-1 { padding: var(--spacing-xs); }
.p-2 { padding: var(--spacing-sm); }
.p-3 { padding: var(--spacing-md); }
.p-4 { padding: var(--spacing-lg); }
.p-5 { padding: var(--spacing-xl); }
.p-6 { padding: var(--spacing-2xl); }

.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

/* Responsive Utilities */
@media (max-width: 768px) {
    .modal {
        max-width: 95%;
        padding: var(--spacing-lg);
    }

    .stat-value {
        font-size: var(--font-2xl);  /* Even smaller on mobile */
    }

    .timeline {
        padding-left: var(--spacing-lg);
    }

    .dropdown-menu {
        min-width: 140px;
    }
}

/* Smooth Transitions for All Interactive Elements */
button, a, input, select, textarea, .card, .tab, .accordion-header {
    transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   PHASE 5: ENHANCED INTERACTIONS INTEGRATION
   Core components work with enhanced-interactions.css
   for unified button system and micro-interactions
   ============================================ */

/* Component cards with enhanced hover states */
.card-interactive {
    cursor: pointer;
    will-change: transform, box-shadow;
}

.card-interactive:hover {
    transform: translateY(-3px);
    box-shadow:
        0 8px 24px rgba(15, 23, 42, 0.12),
        0 0 20px rgba(79, 117, 255, 0.10);
}

/* Enhanced focus states for all interactive components */
.input-field:focus,
.select-field:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow:
        0 0 0 3px rgba(79, 117, 255, 0.08),
        0 1px 3px rgba(79, 117, 255, 0.10);
    transform: translateY(-1px);
}

/* Modal with enhanced entrance animation */
.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
    animation: modalEnter 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalEnter {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Enhanced accordion interactions */
.accordion-header {
    position: relative;
}

.accordion-header:hover {
    background: var(--bg-medium);
    padding-left: calc(var(--spacing-md) + 4px);
}

.accordion-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: var(--color-primary);
    transition: width 250ms cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.accordion-header:hover::before {
    width: 4px;
}

/* Tab interactions with smooth underline */
.tab {
    position: relative;
}

.tab::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--color-primary);
    transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-50%);
}

.tab.active::after {
    width: 100%;
}

.tab:hover:not(.active)::after {
    width: 50%;
    opacity: 0.5;
}

/* Enhanced dropdown with slide animation */
.dropdown-menu {
    animation: dropdownSlide 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Stat cards with number animation support */
.stat-value {
    display: inline-block;
    transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover .stat-value {
    transform: scale(1.05);
    color: var(--color-primary);
}

/* Badge pulse animation for new/important items */
.badge-pulse {
    animation: badgePulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes badgePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 currentColor;
    }
    50% {
        box-shadow: 0 0 0 4px transparent;
    }
}

/* Timeline marker entrance animation */
.timeline-marker {
    animation: markerPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes markerPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Progress bar smooth fill animation */
.progress-fill {
    transition: width 800ms cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: progressShine 2s infinite;
}

@keyframes progressShine {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}
