/* Product Trust Analyzer - Clean CSS */

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #2d3748;
    line-height: 1.6;
    transition: all 0.3s ease;
}

/* Container and layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header styles */
.header {
    background: linear-gradient(135deg, #6b46c1 0%, #9333ea 50%, #c084fc 100%);
    color: white;
    padding: 3rem 0;
    text-align: center;
    margin-bottom: 2rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(107, 70, 193, 0.3);
    position: relative;
    overflow: hidden;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Navigation */
.nav {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    background: white;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

#authLinks {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.theme-switcher {
    display: flex;
    gap: 0.5rem;
    margin-left: 2rem;
}

.theme-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.theme-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.nav a {
    display: inline-block;
    padding: 12px 24px;
    margin: 0 8px;
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
    position: relative;
}

.nav a:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
}

.nav a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 0;
    height: 2px;
    background: #2196F3;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav a:hover::after {
    width: 100%;
}

/* Card styles */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Form styles */
.url-form {
    text-align: center;
}

.url-input {
    width: 100%;
    max-width: 600px;
    padding: 18px 24px;
    font-size: 1.1rem;
    border: 2px solid rgba(139, 92, 246, 0.2);
    border-radius: 25px;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.url-input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 4px 16px rgba(33, 150, 243, 0.2);
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
}

.analyze-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    position: relative;
    overflow: hidden;
}

.analyze-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

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

.analyze-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.analyze-btn:focus {
    outline: 3px solid rgba(33, 150, 243, 0.5);
    outline-offset: 2px;
}

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

.analyze-btn:hover::before {
    left: 100%;
}

/* Loading indicator */
.loading {
    display: none;
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
}

.spinner {
    border: 4px solid rgba(139, 92, 246, 0.1);
    border-top: 4px solid #8b5cf6;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

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

    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 30px rgba(239, 68, 68, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 40px rgba(239, 68, 68, 0.6);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 30px rgba(239, 68, 68, 0.4);
    }
}

/* Results section */
.results {
    display: none;
}

.trust-score {
    text-align: center;
    margin-bottom: 2rem;
}

.score-meter {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    color: white;
    transition: all 0.5s ease;
    position: relative;
    background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
    border: 8px solid #f5f5f5;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1), 0 0 20px rgba(0, 0, 0, 0.1);
}

.score-meter::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    background: white;
    border-radius: 50%;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
}

.score-meter span {
    position: relative;
    z-index: 2;
}

.score-meter.score-high {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.4);
}

.score-meter.score-medium {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.4);
}

.score-meter.score-low {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.4);
}

/* Dynamic Score Colors for #scoreText */
#scoreText {
    font-weight: bold;
    font-size: 1.2em;
    transition: color 0.3s ease;
    color: #6b7280; /* Default gray color */
}

.score-meter #scoreText.score-low {
    color: #dc2626 !important;
}

.score-meter #scoreText.score-medium {
    color: #f59e0b !important;
}

.score-meter #scoreText.score-high {
    color: #059669 !important;
}

/* Fake alert styles */
.fake-alert {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 2px solid #ef4444;
    color: #dc2626;
    padding: 1.5rem;
    border-radius: 15px;
    margin-bottom: 1rem;
    text-align: center;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.1);
    position: relative;
    border-left: 4px solid;
    border-left-color: #F44336;
}

.fake-alert.warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-color: #f59e0b;
    color: #d97706;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.1);
    border-left-color: #FF9800;
}

.fake-alert.safe {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: #10b981;
    color: #059669;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.1);
    border-left-color: #4CAF50;
}

.fake-alert h4 {
    margin-bottom: 0.5rem;
}

.fake-alert ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.fake-alert li {
    margin-bottom: 0.25rem;
}

/* Product info */
.product-info {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
}

.product-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
}

.product-details h3 {
    margin-bottom: 0.5rem;
    color: #8b5cf6;
    font-weight: 600;
}

/* Star distribution */
.star-distribution {
    margin-bottom: 2rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #dee2e6;
}

.star-row {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.star-label {
    width: 60px;
    font-weight: bold;
}

.star-bar {
    flex: 1;
    height: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    margin: 0 10px;
    overflow: hidden;
    position: relative;
    border: 1px solid #dee2e6;
}

.star-fill {
    height: 100%;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    transition: width 0.8s ease-in-out;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.star-count {
    width: 80px;
    text-align: right;
}

/* History table */
.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.history-table th,
.history-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.history-table th {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

.history-table tr:nth-child(even) {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.history-table tr:hover {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Error and success messages */
.error {
    background: #ffebee;
    color: #c62828;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    text-align: center;
}

.success {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    text-align: center;
}

/* Utility classes */
.text-center {
    text-align: center;
}

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

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

.hidden {
    display: none;
}

.mt-1 {
    margin-top: 1rem;
}

.mb-1 {
    margin-bottom: 1rem;
}

.p-1 {
    padding: 1rem;
}

/* Animations */
@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Enhanced header animation */
.header {
    background: linear-gradient(-45deg, #6b46c1, #9333ea, #c084fc, #8b5cf6);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

/* Progress indicators */
.progress-bar {
    width: 100%;
    height: 20px;
    background-color: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #2196F3);
    transition: width 0.5s ease;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
}

.status-badge.excellent {
    background: #4CAF50;
    color: white;
}

.status-badge.good {
    background: #8BC34A;
    color: white;
}

.status-badge.fair {
    background: #FF9800;
    color: white;
}

.status-badge.poor {
    background: #F44336;
    color: white;
}

/* Tooltip styles */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.8rem;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Cache indicator */
#cacheIndicator {
    border-left: 4px solid #FF9800;
}

/* Footer */
footer {
    background: linear-gradient(135deg, #37474f 0%, #263238 100%);
    color: white;
    margin-top: 3rem;
}

footer p {
    margin-bottom: 0.5rem;
}

/* Theme System */
body,
body.purple-theme {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Blue Theme */
body.blue-theme {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

body.blue-theme .header {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 50%, #60a5fa 100%);
}

body.blue-theme .nav a {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

body.blue-theme .nav a:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

body.blue-theme .url-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

body.blue-theme .product-details h3 {
    color: #3b82f6;
}

/* Green Theme */
body.green-theme {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

body.green-theme .header {
    background: linear-gradient(135deg, #059669 0%, #10b981 50%, #34d399 100%);
}

body.green-theme .nav a {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

body.green-theme .nav a:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

body.green-theme .url-input:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

body.green-theme .product-details h3 {
    color: #10b981;
}

/* Dark Theme */
body.dark-theme {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    color: #e2e8f0;
}

body.dark-theme .header {
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 50%, #4a5568 100%);
}

body.dark-theme .nav {
    background: rgba(45, 55, 72, 0.95);
}

body.dark-theme .nav a {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

body.dark-theme .nav a:hover {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
}

body.dark-theme .card {
    background: rgba(45, 55, 72, 0.95);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .url-input {
    background: rgba(45, 55, 72, 0.9);
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-theme .url-input:focus {
    border-color: #4a5568;
    box-shadow: 0 0 0 3px rgba(74, 85, 104, 0.1);
    background: rgba(45, 55, 72, 1);
}

body.dark-theme .product-details h3 {
    color: #a0aec0;
}

body.dark-theme .history-table {
    background: rgba(45, 55, 72, 0.95);
}

body.dark-theme .history-table th {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

body.dark-theme .history-table tr:nth-child(even) {
    background: rgba(74, 85, 104, 0.3);
}

body.dark-theme .history-table tr:hover {
    background: rgba(74, 85, 104, 0.5);
}

/* Dark theme score colors */
body.dark-theme #scoreText.score-low {
    color: #ef4444 !important;
}

body.dark-theme #scoreText.score-medium {
    color: #fbbf24 !important;
}

body.dark-theme #scoreText.score-high {
    color: #22c55e !important;
}

/* Statistics cards styling for better visibility */
.stat-item {
    transition: all 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important;
}

/* Dark theme statistics adjustments */
body.dark-theme .stat-item {
    background: rgba(55, 65, 81, 0.8) !important;
    border: 1px solid rgba(156, 163, 175, 0.3) !important;
    color: #f9fafb !important;
}

body.dark-theme .stat-item div {
    color: #f9fafb !important;
}

body.dark-theme .stat-item div:first-child {
    color: #60a5fa !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

/* Ensure text is always readable */
.stat-item div:first-child {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    font-weight: 900 !important;
}

.stat-item div:last-child {
    font-weight: 600 !important;
    color: #1f2937 !important;
}

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

/* Focus indicators for keyboard navigation */
button:focus,
input:focus,
a:focus {
    outline: 3px solid rgba(33, 150, 243, 0.5);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: more) {
    .card {
        border: 2px solid #000;
    }

    .fake-alert {
        border: 2px solid #000;
    }

    .analyze-btn {
        border: 2px solid #000;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
        color: #e0e0e0;
    }

    .card {
        background: #1e1e1e;
        border: 1px solid #333;
    }

    .url-input {
        background: #2d2d2d;
        color: #e0e0e0;
        border-color: #555;
    }

    .history-table {
        background: #1e1e1e;
    }

    .history-table th {
        background: linear-gradient(135deg, #1976D2 0%, #0D47A1 100%);
    }

    .history-table tr:nth-child(even) {
        background: #2d2d2d;
    }
}

/* Print styles */
@media print {

    .nav,
    .analyze-btn,
    button {
        display: none !important;
    }

    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }

    .header {
        background: #2196F3 !important;
        print-color-adjust: exact;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header h1 {
        font-size: 2rem;
    }

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

    .star-row {
        flex-direction: column;
        align-items: stretch;
    }

    .star-label,
    .star-count {
        text-align: center;
        margin-bottom: 5px;
    }

    .nav a {
        display: block;
        margin: 5px 0;
    }

    .fake-alert {
        font-size: 0.9rem;
    }

    .fake-alert h4 {
        font-size: 1rem;
    }

    .score-meter {
        width: 150px;
        height: 150px;
        font-size: 2.5rem;
    }
}

/* Enhanced mobile responsiveness */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .header p {
        font-size: 1rem;
    }

    .score-meter {
        width: 120px;
        height: 120px;
        font-size: 2rem;
    }

    .nav a {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .url-input {
        font-size: 16px;
        /* Prevents zoom on iOS */
    }
}

/* Tablet optimizations */
@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        padding: 15px;
    }

    .product-info {
        flex-direction: row;
    }

    .star-distribution {
        padding: 1rem;
    }
}

/* Large screen optimizations */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }

    .results {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }

    .trust-score {
        grid-column: 1 / -1;
    }
}