:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --bg-primary: #f9fafb;
    --bg-secondary: #ffffff;
    --background-color: #f9fafb;
    --surface-color: #ffffff;
    --border-color: #cbd5e1;
    --error-color: #ef4444;
    --success-color: #22c55e;
    --border-radius: 12px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

.input-section {
    margin-bottom: 2rem;
}

.url-input-container {
    display: flex;
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

input[type="url"] {
    flex: 1;
    padding: 1rem 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: all 0.2s ease;
    background-color: var(--surface-color);
}

input[type="url"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

button {
    padding: 1rem 2rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.hidden {
    display: none;
}

#loadingIndicator {
    text-align: center;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 1rem;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#results {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

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

.section {
    background: var(--surface);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.section.full-width {
    grid-column: 1 / -1;
}

.element-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.element-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.element-card strong {
    color: var(--primary-color);
}

.selector {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background-color: var(--background-color);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    margin-top: 0.5rem;
    word-break: break-all;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.product-image img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
}

.info-grid {
    display: grid;
    gap: 1rem;
}

.info-item {
    padding: 1rem;
    background-color: var(--background-color);
    border-radius: var(--border-radius);
}

.info-item strong {
    color: var(--primary-color);
    display: block;
    margin-bottom: 0.5rem;
}

.description-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
    max-height: 100px;
    overflow-y: auto;
}

.selector-text {
    display: block;
    font-family: monospace;
    font-size: 0.85rem;
    padding: 0.5rem;
    background-color: var(--background-color);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    overflow-x: auto;
    white-space: nowrap;
    margin-top: 0.5rem;
}

.interactive-list,
.form-section {
    display: grid;
    gap: 1rem;
}

.interactive-item,
.form-item,
.input-item {
    padding: 1rem;
    background-color: var(--background-color);
    border-radius: var(--border-radius);
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.element-type,
.form-action,
.input-name {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
}

h5 {
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.color-card {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
    cursor: pointer;
}

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

.color-preview {
    height: 120px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.color-info {
    padding: 1rem;
}

.color-name {
    display: block;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.color-value {
    display: block;
    font-family: monospace;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.color-percentage {
    display: block;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.harmony-card {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
}

.error-message {
    background-color: #fef2f2;
    border: 1px solid #fee2e2;
    color: var(--error-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
    text-align: center;
}

footer {
    text-align: center;
    margin-top: 3rem;
    color: var(--text-secondary);
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.image-wrapper {
    position: relative;
}

.image-wrapper img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.image-wrapper small {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--on-surface-variant);
}

code {
    background: var(--surface);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--primary);
}

#interactiveElements ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#interactiveElements li {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--outline);
}

#interactiveElements li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.color-box {
    position: relative;
    height: 120px;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

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

.color-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.75rem;
    backdrop-filter: blur(4px);
}

.color-hex {
    display: block;
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.color-name {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.color-percentage {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.harmony-info {
    background-color: var(--background-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-top: 1rem;
}

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

.harmony-info p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

#colorPalette {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.aspect-w-1 {
    position: relative;
    padding-bottom: 100%;
}

.aspect-w-1 > * {
    position: absolute;
    height: 100%;
    width: 100%;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.slide-in {
    animation: slideIn 0.4s ease-out;
}

.focus-ring {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.45);
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

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

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

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

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .url-input-container {
        flex-direction: column;
    }

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

    h1 {
        font-size: 2rem;
    }

    #colorPalette {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    button {
        width: 100%;
    }
}

@media (max-width: 640px) {
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    .text-sm {
        font-size: 0.875rem;
    }
}

@media print {
    .no-print {
        display: none;
    }
    
    body {
        background: white;
    }
    
    .container {
        max-width: none;
        margin: 0;
        padding: 0;
    }
}
