/* CSS Variables - Light Mode (Default) */
:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-light: #e0e7ff;
    --border: #e2e8f0;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-sm: 8px;
    /* Aliases */
    --background: var(--bg-primary);
    --text: var(--text-primary);
    --card-bg: var(--bg-secondary);
    --primary: var(--accent);
    --primary-hover: var(--accent-hover);
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #818cf8;
    --accent-hover: #6366f1;
    --accent-light: #312e81;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    /* Aliases */
    --background: var(--bg-primary);
    --text: var(--text-primary);
    --card-bg: var(--bg-secondary);
    --primary: var(--accent);
    --primary-hover: var(--accent-hover);
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    font-size: 1.25rem;
    transition: transform 0.2s;
    z-index: 100;
}
.theme-toggle:hover { transform: scale(1.1); }

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* Trust Badges */
.badges {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.badge {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.badge-green {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-blue {
    background: rgba(59, 130, 246, 0.15);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-purple {
    background: rgba(139, 92, 246, 0.15);
    color: #7c3aed;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Cards */
.info-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.info-card h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.primary-card {
    border: 2px solid var(--primary);
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.info-item {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-align: center;
}

.info-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.info-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

/* Visual Representation */
.visual-container {
    display: flex;
    justify-content: center;
    padding: 2rem 0;
}

.screen-visual {
    position: relative;
    background: var(--border);
    border: 3px solid var(--text-secondary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 300px;
    max-height: 200px;
    min-width: 200px;
    min-height: 120px;
}

.viewport-visual {
    background: var(--primary);
    opacity: 0.3;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.visual-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text);
}

.screen-label {
    position: absolute;
    bottom: -1.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.visual-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.legend-color.screen {
    background: var(--border);
    border: 2px solid var(--text-secondary);
}

.legend-color.viewport {
    background: var(--primary);
    opacity: 0.5;
}

/* Device Match */
.device-match {
    text-align: center;
    padding: 1rem;
}

.device-match .device-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.device-match .device-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.loading {
    color: var(--text-muted);
    font-style: italic;
}

/* Resolution Table */
.resolutions-table {
    overflow-x: auto;
}

.resolution-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 0.5fr;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--background);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.resolution-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 0.5fr;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    align-items: center;
}

.resolution-row:last-child {
    border-bottom: none;
}

.resolution-row.match {
    background: var(--accent-light);
    border-radius: var(--radius-sm);
}

.match-indicator {
    color: var(--success);
    font-weight: 600;
}

/* Resize Tester */
.resize-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.resize-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.resize-input label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.resize-input input {
    width: 100px;
    padding: 0.5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background: var(--background);
    color: var(--text);
    text-align: center;
}

.resize-input input:focus {
    outline: none;
    border-color: var(--primary);
}

.resize-separator {
    font-size: 1.25rem;
    color: var(--text-muted);
}

.btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

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

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

/* Presets */
.preset-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.preset-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    background: var(--background);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

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

.hint {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

/* FAQ */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.faq-item {
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.faq-item summary {
    padding: 1rem;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    color: var(--text);
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::before {
    content: '▶';
    margin-right: 0.5rem;
    font-size: 0.75rem;
    transition: transform 0.2s;
    display: inline-block;
}

.faq-item[open] summary::before {
    transform: rotate(90deg);
}

.faq-item p {
    padding: 0 1rem 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Footer */
footer {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 0;
}

footer p {
    margin: 0.25rem 0;
}

/* Responsive */
@media (max-width: 600px) {
    header h1 {
        font-size: 1.75rem;
    }
    
    .info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .resolution-header,
    .resolution-row {
        grid-template-columns: 1.5fr 1fr 1fr 0.5fr;
        font-size: 0.75rem;
        padding: 0.5rem;
    }
    
    .resize-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .resize-input {
        justify-content: center;
    }
}

/* Dark Mode Element Overrides */
[data-theme="dark"] body {
    background: #0f172a;
    color: #f1f5f9;
}

[data-theme="dark"] .info-card,
[data-theme="dark"] .faq-item {
    background: #1e293b;
}

[data-theme="dark"] .info-item {
    background: #0f172a;
    border-color: #334155;
}

[data-theme="dark"] input {
    background: #0f172a;
    color: #f1f5f9;
    border-color: #334155;
}

[data-theme="dark"] .preset-btn {
    background: #0f172a;
    color: #94a3b8;
    border-color: #334155;
}

[data-theme="dark"] .resolution-row {
    border-color: #334155;
}

[data-theme="dark"] .resolution-header {
    background: #0f172a;
}

[data-theme="dark"] .screen-visual {
    background: #334155;
    border-color: #64748b;
}

[data-theme="dark"] .primary-card {
    border-color: #818cf8;
}
