/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #7868E6;
    --secondary-color: #B8B5FF;
    --accent-color: #EDEEF7;
    --light-color: #E4FBFF;
    --error-color: #FFB4B4;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --text-dark: #2c2c2c;
    --text-light: #666;
    --border-color: #ddd;
    --shadow: 0 2px 10px rgba(120, 104, 230, 0.1);
    --shadow-hover: 0 4px 20px rgba(120, 104, 230, 0.2);
    --border-radius: 8px;
    --transition: all 0.3s ease;
    --focus-outline: 2px solid var(--primary-color);
    --focus-offset: 2px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: linear-gradient(135deg, var(--light-color) 0%, var(--accent-color) 100%);
    min-height: 100vh;
    position: relative;
    font-size: 16px; /* Base font size for better accessibility */
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* Paper texture effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 50%, transparent 20%, rgba(255,255,255,0.3) 21%, rgba(255,255,255,0.3) 34%, transparent 35%, transparent),
        linear-gradient(0deg, transparent 24%, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.05) 26%, transparent 27%, transparent 74%, rgba(255,255,255,0.05) 75%, rgba(255,255,255,0.05) 76%, transparent 77%, transparent);
    background-size: 30px 30px;
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 255, 0.98) 100%);
    backdrop-filter: blur(15px);
    box-shadow: 0 4px 20px rgba(120, 104, 230, 0.1);
    border-bottom: 1px solid rgba(120, 104, 230, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    transition: all 0.3s ease;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Brand Section */
.header__brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.header__logo-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(120, 104, 230, 0.3);
   
}

.header__logo-container:hover {
    transform: scale(1.05);
}

.header__logo {
    width: 35px;
    height: 35px;
    object-fit: contain;
   
}

.header__title-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.header__title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
    line-height: 1.2;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.05);
}

.header__subtitle {
    font-size: 0.85rem;
    color: var(--text-color);
    margin: 0;
    font-weight: 400;
    opacity: 0.8;
    line-height: 1.2;
}

/* Navigation */
.header__nav {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.nav__btn {
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid transparent;
    color: var(--primary-color);
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.95rem;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.nav__btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.nav__btn:hover::before {
    left: 100%;
}

.nav__btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(120, 104, 230, 0.3);
    border-color: var(--primary-color);
}

.nav__btn--active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(120, 104, 230, 0.4);
}

.nav__btn--active:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(120, 104, 230, 0.5);
}

.nav-icon {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-text {
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Main Content */
.main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

.section {
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.section--active {
    display: block;
}

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

.section__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section__title {
    font-size: 2rem;
    color: var(--primary-color);
    font-weight: 600;
    margin: 0;
    word-break: break-word;
}

/* Button Styles */
.btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    font-size: 1rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    white-space: nowrap;
    word-break: keep-all;
}

.btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn:active {
    transform: translateY(0);
}

.btn--secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn--secondary:hover {
    background: var(--primary-color);
    color: white;
}

.btn--danger {
    background: var(--error-color);
    color: white;
}

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

.btn--small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    min-height: 36px;
}

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

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    width: 100%;
}

.product-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    width: 100%;
    min-width: 0; /* Allow shrinking */
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.product-card__image {
    width: 100%;
    height: 200px;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    background: var(--light-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 0.9rem;
    overflow: hidden;
    flex-shrink: 0;
}

.product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card__image span {
    padding: 1rem;
    text-align: center;
    word-break: break-word;
}

.product-card__title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    word-break: break-word;
    line-height: 1.3;
}

.product-card__description {
    color: var(--text-light);
    margin-bottom: 1rem;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: break-word;
}

.product-card__price {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1rem;
    word-break: break-word;
}

.product-card__actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: auto;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1000;
    animation: modalFadeIn 0.3s ease-out;
}

.modal--active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal__content {
    background: var(--bg-color, white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-hover);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
    margin: 20px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal__header {
    background: var(--primary-color);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.modal__title {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.modal__close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.modal__close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Form Styles */
.form {
    padding: 2rem;
}

.form__group {
    margin-bottom: 1.5rem;
}

.form__label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
    word-break: break-word;
}

.form__input,
.form__textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    box-sizing: border-box;
    min-height: 44px;
}

.form__input:focus,
.form__textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(120, 104, 230, 0.1);
}

.form__textarea {
    resize: vertical;
    min-height: 100px;
}

.form__actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 2rem;
}

/* Camera Controls */
.camera-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.image-preview {
    margin-bottom: 1rem;
    text-align: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

/* Comparison Container */
.comparison-container {
    display: grid;
    gap: 2rem;
}

.criteria-setup {
    background: rgba(255, 255, 255, 0.9);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.criteria-setup h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.criteria-list {
    display: grid;
    gap: 1rem;
}

.criteria-item {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.criteria-item__info {
    flex: 1;
    min-width: 0;
}

.criteria-item__name {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    word-break: break-word;
}

.criteria-item__weight {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.criteria-item__description {
    color: var(--text-light);
    font-size: 0.9rem;
    word-break: break-word;
}

.criteria-item__actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* Comparison Table */
.comparison-table-container {
    background: rgba(255, 255, 255, 0.9);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
    width: 100%;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    min-width: 600px; /* Ensure minimum width for readability */
}

.comparison-table th,
.comparison-table td {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    word-break: break-word;
}

.comparison-table th {
    background: var(--accent-color);
    font-weight: 600;
    color: var(--primary-color);
    position: sticky;
    top: 0;
    z-index: 5;
    white-space: nowrap;
}

.comparison-table tr:hover {
    background: rgba(120, 104, 230, 0.05);
}

.comparison-table td:first-child {
    text-align: left;
    font-weight: 500;
    min-width: 150px;
}

.score-input {
    width: 80px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    text-align: center;
    min-height: 36px;
    font-size: 1rem;
}

.score-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(120, 104, 230, 0.1);
}

/* Results Styles */
.results-container {
    display: grid;
    gap: 2rem;
    width: 100%;
}

.results-summary {
    background: rgba(255, 255, 255, 0.9);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.results-summary h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
    word-break: break-word;
}

.winner-card {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-hover);
}

.winner-card h4 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    word-break: break-word;
}

.winner-card .score {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.results-chart {
    background: rgba(255, 255, 255, 0.9);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.chart-placeholder {
    text-align: center;
    color: var(--text-light);
    padding: 3rem;
    font-style: italic;
}

.chart-bars {
    display: flex;
    align-items: end;
    gap: 1rem;
    height: 300px;
    padding: 1rem 0;
    overflow-x: auto;
    min-width: 100%;
}

.chart-bar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    flex: 1;
}

.chart-bar {
    width: 100%;
    background: linear-gradient(to top, var(--primary-color), var(--secondary-color));
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    position: relative;
    transition: var(--transition);
    min-height: 20px;
}

.chart-bar:hover {
    transform: scaleY(1.05);
}

.chart-value {
    margin-top: 0.5rem;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.chart-label {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-light);
    text-align: center;
    word-break: break-word;
    max-width: 100%;
}

.results-details {
    background: rgba(255, 255, 255, 0.9);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    min-width: 500px;
}

.results-table th,
.results-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    word-break: break-word;
}

.results-table th {
    background: var(--accent-color);
    font-weight: 600;
    color: var(--primary-color);
    white-space: nowrap;
}

.results-table .rank {
    font-weight: 600;
    text-align: center;
}

.results-table .rank-1 { color: #FFD700; }
.results-table .rank-2 { color: #C0C0C0; }
.results-table .rank-3 { color: #CD7F32; }

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 2rem 0;
    text-align: center;
    margin-top: 3rem;
    box-shadow: 0 -2px 10px rgba(120, 104, 230, 0.1);
}

.footer__text {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    word-break: break-word;
}

.footer__text:last-of-type {
    margin-bottom: 1rem;
}

.footer__text a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.footer__text a:hover {
    text-decoration: underline;
    color: var(--secondary-color);
}

.footer__version {
    color: var(--text-light);
    font-size: 0.8rem;
    opacity: 0.8;
    margin-top: 0.5rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.loading-overlay--active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--accent-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    max-width: 400px;
    width: calc(100vw - 40px);
}

.toast {
    background: white;
    border-radius: var(--border-radius);
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-hover);
    border-left: 4px solid var(--primary-color);
    animation: toastSlideIn 0.3s ease-out;
    word-break: break-word;
}

.toast--success {
    border-left-color: var(--success-color);
}

.toast--error {
    border-left-color: var(--error-color);
}

.toast--warning {
    border-left-color: var(--warning-color);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary-color);
    animation: toastProgress 3s linear;
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.empty-state h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-item {
    background: rgba(255, 255, 255, 0.9);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-light);
    font-size: 0.9rem;
    word-break: break-word;
}

/* Form Validation */
.field--valid {
    border-color: var(--success-color) !important;
}

.field--error {
    border-color: var(--error-color) !important;
}

/* Responsive Design - Tablet */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header .container {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 15px;
    }
    
    .header__brand {
        justify-content: center;
        width: 100%;
    }
    
    .header__title {
        font-size: 1.6rem;
        text-align: center;
    }
    
    .header__subtitle {
        text-align: center;
        font-size: 0.8rem;
    }
    
    .header__nav {
        justify-content: center;
        width: 100%;
        gap: 0.5rem;
    }
    
    .nav__btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        min-height: 44px;
        flex: 1;
        max-width: 120px;
    }
    
    .nav-text {
        display: none;
    }
    
    .nav-icon {
        font-size: 1.2rem;
    }
    
    .section__header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .section__title {
        font-size: 1.8rem;
        text-align: center;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1rem;
    }
    
    .product-card {
        padding: 1.2rem;
    }
    
    .product-card__image {
        height: 180px;
    }
    
    .form__actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form__actions .btn {
        width: 100%;
    }
    
    .camera-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .camera-controls .btn {
        width: 100%;
    }
    
    .comparison-table-container {
        padding: 1rem;
        overflow-x: auto;
    }
    
    .comparison-table {
        min-width: 500px;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
    }
    
    .results-actions {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .results-actions .btn {
        width: 100%;
    }
    
    .criteria-item {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .criteria-item__actions {
        justify-content: center;
        width: 100%;
    }
    
    .criteria-item__actions .btn {
        flex: 1;
        min-width: 0;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .chart-bars {
        height: 250px;
        gap: 0.75rem;
    }
    
    .chart-bar-container {
        min-width: 70px;
    }
    
    .detail-summary {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }
    
    .toast-container {
        left: 10px;
        right: 10px;
        max-width: none;
        top: 10px;
    }
    
    .modal__content {
        width: 95%;
        margin: 10px;
        max-height: 95vh;
    }
    
    .modal__header {
        padding: 1rem 1.5rem;
    }
    
    .modal__title {
        font-size: 1.2rem;
    }
    
    .form {
        padding: 1.5rem;
    }
}

/* Responsive Design - Mobile */
@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .header .container {
        padding: 0.75rem 10px;
        gap: 0.75rem;
    }
    
    .header__logo-container {
        width: 45px;
        height: 45px;
    }
    
    .header__logo {
        width: 30px;
        height: 30px;
    }
    
    .header__title {
        font-size: 1.4rem;
    }
    
    .header__subtitle {
        font-size: 0.75rem;
    }
    
    .header__nav {
        gap: 0.4rem;
    }
    
    .nav__btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        min-height: 40px;
        max-width: 100px;
        border-radius: 10px;
    }
    
    .nav-icon {
        font-size: 1.1rem;
    }
    
    .section__title {
        font-size: 1.5rem;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .product-card {
        padding: 1rem;
    }
    
    .product-card__image {
        height: 150px;
    }
    
    .product-card__title {
        font-size: 1.1rem;
    }
    
    .product-card__actions {
        justify-content: center;
    }
    
    .product-card__actions .btn {
        flex: 1;
        min-width: 0;
        font-size: 0.9rem;
        padding: 0.5rem 0.75rem;
    }
    
    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
        min-height: 40px;
    }
    
    .nav__btn {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
        min-height: 40px;
    }
    
    .comparison-table {
        min-width: 400px;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }
    
    .score-input {
        width: 60px;
        padding: 0.25rem;
        font-size: 0.9rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .chart-bars {
        height: 200px;
        gap: 8px;
    }
    
    .chart-bar-container {
        min-width: 60px;
    }
    
    .chart-label {
        font-size: 0.75rem;
    }
    
    .modal__content {
        width: 98%;
        margin: 5px;
        max-height: 98vh;
    }
    
    .modal__header {
        padding: 0.75rem 1rem;
    }
    
    .modal__title {
        font-size: 1.1rem;
    }
    
    .modal__close {
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
    }
    
    .form {
        padding: 1rem;
    }
    
    .form__input,
    .form__textarea {
        font-size: 0.9rem;
        padding: 0.6rem;
    }
    
    .footer {
        padding: 1.5rem 0;
    }
    
    .footer__text {
        font-size: 0.8rem;
    }
}

/* Extra Small Mobile */
@media (max-width: 360px) {
    .container {
        padding: 0 8px;
    }
    
    .header .container {
        padding: 0.6rem 8px;
        gap: 0.6rem;
    }
    
    .header__logo-container {
        width: 40px;
        height: 40px;
    }
    
    .header__logo {
        width: 28px;
        height: 28px;
    }
    
    .header__title {
        font-size: 1.3rem;
    }
    
    .header__subtitle {
        font-size: 0.7rem;
    }
    
    .header__nav {
        gap: 0.3rem;
    }
    
    .nav__btn {
        padding: 0.45rem 0.6rem;
        font-size: 0.8rem;
        min-height: 38px;
        max-width: 90px;
        border-radius: 8px;
    }
    
    .nav-icon {
        font-size: 1rem;
    }
    
    .section__title {
        font-size: 1.3rem;
    }
    
    .nav__btn {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
        min-width: 100px;
    }
    
    .product-card {
        padding: 0.8rem;
    }
    
    .product-card__image {
        height: 120px;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    .comparison-table {
        min-width: 350px;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 0.4rem 0.2rem;
        font-size: 0.75rem;
    }
    
    .score-input {
        width: 50px;
        padding: 0.2rem;
        font-size: 0.8rem;
    }
    
    .modal__content {
        width: 99%;
        margin: 2px;
    }
    
    .modal__header {
        padding: 0.5rem 0.75rem;
    }
    
    .modal__title {
        font-size: 1rem;
    }
    
    .form {
        padding: 0.8rem;
    }
}

/* Accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for keyboard navigation */
.btn:focus,
.form__input:focus,
.form__textarea:focus,
.nav__btn:focus,
.score-input:focus,
.modal__close:focus {
    outline: var(--focus-outline);
    outline-offset: var(--focus-offset);
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -140px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 10001;
}

.skip-link:focus {
    top: 6px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
        --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.4);
        --border-color: #000;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles */
@media print {
    .header,
    .footer,
    .nav__btn,
    .btn,
    .modal,
    .toast-container {
        display: none !important;
    }
    
    .main {
        padding: 0;
    }
    
    .section {
        display: block !important;
        page-break-inside: avoid;
    }
    
    .product-card,
    .criteria-item,
    .results-summary {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* Result Details Modal */
.result-details-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
    animation: modalFadeIn 0.3s ease-out;
}

.result-details-modal .modal__content {
    background: var(--bg-color, white);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(120, 104, 230, 0.3);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
    border: 1px solid var(--border-color);
}

.result-details-modal .modal__header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.result-details-modal .modal__header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    word-break: break-word;
}

.result-details-modal .modal__close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.result-details-modal .modal__close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.result-details-modal .modal__body {
    padding: 2rem;
}

/* Detail Summary Section */
.detail-summary {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(120, 104, 230, 0.1), rgba(255, 107, 107, 0.1));
    border-radius: 12px;
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

.detail-score,
.detail-rank {
    text-align: center;
    flex: 1;
    min-width: 120px;
}

.score-large,
.rank-large {
    display: block;
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    text-shadow: 0 2px 4px rgba(120, 104, 230, 0.3);
    margin-bottom: 0.5rem;
    word-break: keep-all;
}

.rank-large {
    color: var(--secondary-color);
    text-shadow: 0 2px 4px rgba(255, 107, 107, 0.3);
}

.score-label,
.rank-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    word-break: break-word;
}

/* Criteria Scores Table */
.criteria-scores-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 500px;
}

.criteria-scores-table th {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.criteria-scores-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
    word-break: break-word;
}

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

.criteria-scores-table tr:hover {
    background: rgba(120, 104, 230, 0.05);
}

.criteria-scores-table th:nth-child(1) { width: 40%; }
.criteria-scores-table th:nth-child(2) { width: 15%; }
.criteria-scores-table th:nth-child(3) { width: 15%; }
.criteria-scores-table th:nth-child(4) { width: 30%; }

/* Responsive Design for Result Details Modal */
@media (max-width: 768px) {
    .result-details-modal .modal__content {
        width: 95%;
        max-height: 95vh;
        margin: 10px;
    }
    
    .result-details-modal .modal__header {
        padding: 1rem 1.5rem;
    }
    
    .result-details-modal .modal__header h3 {
        font-size: 1.2rem;
    }
    
    .result-details-modal .modal__body {
        padding: 1.5rem;
    }
    
    .detail-summary {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1rem;
    }
    
    .score-large,
    .rank-large {
        font-size: 2.5rem;
    }
    
    .criteria-scores-table {
        font-size: 0.85rem;
        min-width: 400px;
    }
    
    .criteria-scores-table th,
    .criteria-scores-table td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .result-details-modal .modal__content {
        width: 98%;
        margin: 5px;
        max-height: 98vh;
    }
    
    .result-details-modal .modal__header {
        padding: 0.75rem 1rem;
    }
    
    .result-details-modal .modal__header h3 {
        font-size: 1.1rem;
    }
    
    .result-details-modal .modal__body {
        padding: 1rem;
    }
    
    .detail-summary {
        padding: 0.75rem;
    }
    
    .score-large,
    .rank-large {
        font-size: 2rem;
    }
    
    .criteria-scores-table {
        font-size: 0.8rem;
        min-width: 350px;
    }
    
    .criteria-scores-table th,
    .criteria-scores-table td {
        padding: 0.5rem 0.25rem;
    }
    
    .criteria-scores-table th:nth-child(1) { width: 35%; }
    .criteria-scores-table th:nth-child(2) { width: 20%; }
    .criteria-scores-table th:nth-child(3) { width: 20%; }
    .criteria-scores-table th:nth-child(4) { width: 25%; }
}

@media (max-width: 360px) {
    .result-details-modal .modal__content {
        width: 99%;
        margin: 2px;
    }
    
    .result-details-modal .modal__header {
        padding: 0.5rem 0.75rem;
    }
    
    .result-details-modal .modal__header h3 {
        font-size: 1rem;
    }
    
    .result-details-modal .modal__body {
        padding: 0.8rem;
    }
    
    .score-large,
    .rank-large {
        font-size: 1.8rem;
    }
    
    .criteria-scores-table {
        min-width: 300px;
        font-size: 0.75rem;
    }
    
    .criteria-scores-table th,
    .criteria-scores-table td {
        padding: 0.4rem 0.2rem;
    }
}

/* Animation for modal content */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Scrollbar styling for modal */
.result-details-modal .modal__content::-webkit-scrollbar {
    width: 8px;
}

.result-details-modal .modal__content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.result-details-modal .modal__content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.result-details-modal .modal__content::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Results Actions */
.results-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.results-actions .btn {
    flex: 1;
    min-width: 140px;
    justify-content: center;
}

.results-actions .btn--danger {
    flex: 0 0 auto;
    min-width: 160px;
}

@media (max-width: 768px) {
    .results-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .results-actions .btn {
        width: 100%;
        min-width: 0;
    }
    
    .results-actions .btn--danger {
        width: 100%;
        min-width: 0;
    }
}
