:root {
    /* Light theme colors */
    --md-sys-color-primary: #6750A4;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #EADDFF;
    --md-sys-color-on-primary-container: #21005D;
    --md-sys-color-secondary: #625B71;
    --md-sys-color-on-secondary: #FFFFFF;
    --md-sys-color-secondary-container: #E8DEF8;
    --md-sys-color-on-secondary-container: #1D192B;
    --md-sys-color-tertiary: #7D5260;
    --md-sys-color-on-tertiary: #FFFFFF;
    --md-sys-color-surface: #FEF7FF;
    --md-sys-color-on-surface: #1D1B20;
    --md-sys-color-surface-variant: #E7E0EC;
    --md-sys-color-on-surface-variant: #49454F;
    --md-sys-color-outline: #79747E;
    --md-sys-color-outline-variant: #CAC4D0;
    --md-sys-color-error: #BA1A1A;
    --md-sys-color-on-error: #FFFFFF;
    --md-sys-color-error-container: #FFDAD6;
    --md-sys-color-on-error-container: #410002;
    --md-sys-color-surface-container: #F3EDF7;
    --md-sys-color-surface-container-high: #ECE6F0;
}

[data-theme="dark"] {
    /* Dark theme colors */
    --md-sys-color-primary: #D0BCFF;
    --md-sys-color-on-primary: #381E72;
    --md-sys-color-primary-container: #4F378B;
    --md-sys-color-on-primary-container: #EADDFF;
    --md-sys-color-secondary: #CCC2DC;
    --md-sys-color-on-secondary: #332D41;
    --md-sys-color-secondary-container: #4A4458;
    --md-sys-color-on-secondary-container: #E8DEF8;
    --md-sys-color-tertiary: #EFB8C8;
    --md-sys-color-on-tertiary: #492532;
    --md-sys-color-surface: #141218;
    --md-sys-color-on-surface: #E6E0E9;
    --md-sys-color-surface-variant: #49454F;
    --md-sys-color-on-surface-variant: #CAC4D0;
    --md-sys-color-outline: #938F99;
    --md-sys-color-outline-variant: #49454F;
    --md-sys-color-error: #FFB4AB;
    --md-sys-color-on-error: #690005;
    --md-sys-color-error-container: #93000A;
    --md-sys-color-on-error-container: #FFDAD6;
    --md-sys-color-surface-container: #211F26;
    --md-sys-color-surface-container-high: #2B2930;
}

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

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Header styles */
.app-header {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-link {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left h1 {
    font-size: 1.5rem;
    font-weight: 500;
    margin: 0;
}

.header-icon {
    width: 42px;
    height: 42px;
    fill: currentColor;
}

.header-left a {
    color: inherit;
    text-decoration: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding-top: 4px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.icon-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: var(--md-sys-color-surface-container);
    min-width: 160px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    z-index: 1;
    padding: 8px 0;
    overflow: hidden;
    max-height: 50vh;
    overflow-y: scroll;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    color: var(--md-sys-color-on-surface);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    transition: background-color 0.2s;
}

.dropdown-content a:hover {
    background-color: var(--md-sys-color-secondary-container);
}

/* Main content */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.calculator-card {
    background-color: var(--md-sys-color-surface-container);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Band selector */
.band-selector {
    display: flex;
    gap: 8px;
    margin-top: 24px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.band-option {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border: 2px solid transparent;
    padding: 12px 24px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.band-option.active {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

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

/* Resistor display */
.resistor-display {
    text-align: center;
    margin: 32px 0;
}

.resistor-svg {
    max-width: 100%;
    height: auto;
    width: 400px;
}

.band-label {
    font-size: 10px;
    fill: var(--md-sys-color-on-surface-variant);
    text-anchor: middle;
}

/* Results */
.results-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.result-field {
    background-color: var(--md-sys-color-surface);
    border: 2px solid var(--md-sys-color-outline-variant);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.result-label {
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 8px;
    font-weight: 500;
}

.result-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--md-sys-color-primary);
    word-break: break-all;
}

/* Color table */
.color-table-section {
    margin: 24px 0;
}

.resistor-band-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    background-color: var(--md-sys-color-surface);
    overflow: hidden;
}

.resistor-band-table thead {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.resistor-band-table th {
    padding: 12px 8px;
    text-align: center;
    font-weight: 500;
    font-size: 0.875rem;
}

.resistor-band-table td {
    padding: 4px;
    text-align: center;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    vertical-align: middle;
}

.resistor-band-table td:first-child {
    padding: 8px 12px;
    font-weight: 500;
    text-align: left;
}

.resistor-band-table tbody tr:hover {
    background-color: var(--md-sys-color-secondary-container);
}

/* Radio button styling */
.color-input {
    display: none;
}

.color-choice {
    display: block;
    width: 100%;
    height: 32px;
    margin: 1px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 500;
}

.color-input:checked+.color-choice {
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 2px var(--md-sys-color-primary);
    transform: scale(0.95);
}

/* Color classes */
.bg-black {
    background-color: #000000;
    color: white;
}

.bg-brown {
    background-color: #8B4513;
    color: white;
}

.bg-red {
    background-color: #FF0000;
    color: white;
}

.bg-orange {
    background-color: #FFA500;
    color: black;
}

.bg-yellow {
    background-color: #FFFF00;
    color: black;
}

.bg-green {
    background-color: #008000;
    color: white;
}

.bg-blue {
    background-color: #0000FF;
    color: white;
}

.bg-violet {
    background-color: #8A2BE2;
    color: white;
}

.bg-grey {
    background-color: #808080;
    color: white;
}

.bg-white {
    background-color: #FFFFFF;
    color: black;
    border: 1px solid #ccc;
}

.bg-gold {
    background-color: #FFD700;
    color: black;
}

.bg-silver {
    background-color: #C0C0C0;
    color: black;
}

.bg-pink {
    background-color: #FFC0CB;
    color: black;
}

.no-value {
    background: repeating-linear-gradient(45deg,
            rgba(0, 0, 0, 0.05),
            rgba(0, 0, 0, 0.05) 5px,
            rgba(255, 255, 255, 0.08) 5px,
            rgba(255, 255, 255, 0.08) 10px);
    color: var(--md-sys-color-on-surface-variant);
    cursor: not-allowed;
}

/* Share section */
.share-section {
    text-align: center;
    margin: 24px 0;
}

.share-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 16px;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
}


.share-btn.facebook {
    background-color: #1877F2;
}

.share-btn.twitter {
    background-color: #000000;
}

.share-btn.reddit {
    background-color: #FF4500;
}

.share-btn.pinterest {
    background-color: #E60023;
}

.share-btn.email {
    background-color: #34495e;
}

.share-btn.copy {
    background-color: var(--md-sys-color-primary);
}

.share-title {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--md-sys-color-primary);
    margin-bottom: 16px;
}

/* Article */
.info-article {
    background-color: var(--md-sys-color-surface-container);
    border-radius: 16px;
    padding: 24px;
    margin: 24px 0;
}

.info-article h2 {
    color: var(--md-sys-color-primary);
    margin-bottom: 16px;
    font-size: 1.5rem;
    font-weight: 500;
}

.info-article h3 {
    color: var(--md-sys-color-primary);
    margin: 20px 0 12px 0;
    font-size: 1.2rem;
    font-weight: 500;
}

.info-article p {
    margin-bottom: 16px;
    line-height: 1.6;
}

.info-article ol,
.info-article ul {
    margin-left: 20px;
    margin-bottom: 16px;
}

.info-article li {
    margin-bottom: 8px;
}

/* Footer */
.app-footer {
    background-color: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
    padding: 24px;
    text-align: center;
    margin-top: 48px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--md-sys-color-primary);
    text-decoration: none;
    font-weight: 500;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* Advanced toggle */
.advanced-toggle {
    text-align: center;
    margin: 16px 0;
}

.toggle-button {
    background: none;
    border: 2px solid var(--md-sys-color-primary);
    color: var(--md-sys-color-primary);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.toggle-button:hover {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.advanced-results {
    display: none;
}

.advanced-results.show {
    display: grid;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
    padding: 12px 24px;
    border-radius: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.toast.show {
    opacity: 1;
}

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

    .calculator-card {
        padding: 0;
        background-color: transparent;
        border-radius: 0;
        box-shadow: none;
    }

    .header-left h1 {
        font-size: 1.1rem;
    }

    .header-icon {
        width: 42px;
        height: 42px;
    }

    .band-selector {
        gap: 4px;
    }

    .band-option {
        padding: 8px 16px;
        font-size: 0.875rem;
    }

    .resistor-band-table {
        font-size: 0.8rem;
    }

    .resistor-band-table th {
        padding: 6px 2px;
        font-size: 0.65rem;
    }

    .resistor-band-table td {
        padding: 1px;
    }

    .resistor-band-table td:first-child {
        padding: 3px 4px;
        font-size: 0.7rem;
        width: 60px;
    }

    .color-choice {
        height: 28px;
        font-size: 0.8rem;
    }

    .footer-links {
        flex-direction: column;
        gap: 12px;
    }

    .share-buttons {
        gap: 8px;
    }

    .share-btn {
        width: 44px;
        height: 44px;
    }
}

@media (max-width: 480px) {
    .resistor-band-table th {
        padding: 4px 1px;
        font-size: 0.6rem;
    }

    .resistor-band-table td:first-child {
        padding: 2px 3px;
        font-size: 0.65rem;
        width: 50px;
    }

    .color-choice {
        height: 24px;
        font-size: 0.8rem;
    }

    .header-left h1 {
        font-size: 1rem;
    }
}

/* Utility classes */
.hidden {
    display: none !important;
}

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

.mb-16 {
    margin-bottom: 16px;
}

.mt-16 {
    margin-top: 16px;
}