:root {
    --gigantti-green: #78be20;
    --gigantti-blue: #003057;
    --bg-section: #f9f9f9;
    --border-neutral: #e6e6e6;
    --text-dark: #1e1e1e;
    --alert-red: #e20000;
    --white: #ffffff;
    --text-light: #666666;
    --text-muted: #999999;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-dark);
    background: var(--bg-section);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--white);
    box-shadow: var(--shadow-lg);
}

.header {
    background: var(--white);
    color: var(--text-dark);
    padding: 1rem 2rem;
    position: relative;
    border-bottom: 1px solid var(--border-neutral);
    box-shadow: var(--shadow-sm);
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gigantti-green);
}

.header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.author-info h1 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin: 0;
    color: var(--text-dark);
}

.disclaimer {
    background: var(--gigantti-green);
    padding: 0.2rem 0.6rem;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    box-shadow: 0 2px 8px rgba(120, 190, 32, 0.3);
    color: white;
}

.subtitle {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 0.25rem;
    font-weight: 400;
    color: var(--text-light);
}

.subtitle a {
    color: var(--gigantti-green);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-fast);
    border-bottom: 1px solid transparent;
}

.subtitle a:hover {
    border-bottom-color: var(--gigantti-green);
    opacity: 1;
}

.main {
    flex: 1;
    padding: 2rem;
    background: var(--bg-section);
}

.build-interface {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 2rem;
    align-items: start;
}

.component-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.component-card {
    background: var(--white);
    border: 1px solid var(--border-neutral);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.component-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    transition: var(--transition-smooth);
}

.component-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(120, 190, 32, 0.3);
}

.component-card.filled {
    border-color: var(--gigantti-green);
    background: linear-gradient(135deg, #f8fdf4 0%, var(--white) 100%);
    padding: 1.25rem;
}

.component-card.filled .component-display {
    margin-top: 0.5rem;
    padding: 0.625rem;
}

.component-card.filled .component-display h4 {
    font-size: 12px;
    margin-bottom: 0.25rem;
}

.component-card.filled .component-display p {
    font-size: 10px;
    margin-bottom: 0.1rem;
}

.component-card.error {
    border-color: var(--alert-red);
    background: linear-gradient(135deg, #fef8f8 0%, var(--white) 100%);
}

.component-card.error::before {
    background: var(--alert-red);
}

.component-card.loading {
    position: relative;
}

.component-card.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--gigantti-green), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.component-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.component-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    letter-spacing: -0.01em;
}

.status-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition-smooth);
    border: 2px solid transparent;
}

.component-card.filled .status-icon {
    background: var(--gigantti-green);
    color: white;
    transform: scale(1.1);
}

.component-card.filled .status-icon::after {
    content: '✓';
}

.component-card.error .status-icon {
    background: var(--alert-red);
    color: white;
    animation: shake 0.5s ease-in-out;
}

.component-card.error .status-icon::after {
    content: '!';
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

.optional-tag {
    background: rgba(120, 190, 32, 0.1);
    color: var(--gigantti-green);
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(120, 190, 32, 0.2);
}

.component-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-neutral);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition-fast);
    background: var(--white);
    font-weight: 400;
}

.component-input:focus {
    outline: none;
    border-color: var(--gigantti-green);
    box-shadow: 0 0 0 3px rgba(120, 190, 32, 0.1);
    transform: translateY(-1px);
}

.component-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.component-display {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-section);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--gigantti-green);
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.component-display h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: var(--text-dark);
    line-height: 1.3;
}

.component-display p {
    font-size: 11px;
    color: var(--text-light);
    margin-bottom: 0.125rem;
    line-height: 1.3;
}

.component-display p:last-child {
    margin-bottom: 0;
}

.add-btn {
    background: transparent;
    border: 2px dashed var(--border-neutral);
    color: var(--text-light);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    margin-top: 1rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.add-btn::before {
    content: '+';
    font-size: 16px;
    font-weight: 600;
}

.add-btn:hover {
    border-color: var(--gigantti-green);
    color: var(--gigantti-green);
    background: rgba(120, 190, 32, 0.05);
    transform: translateY(-1px);
}

.additional-storage {
    position: relative;
    margin-top: 0.75rem;
    padding-left: 1rem;
    border-left: 3px solid transparent;
    transition: var(--transition-smooth);
}

.additional-storage.filled {
    border-left-color: var(--gigantti-green);
}

.additional-storage.error {
    border-left-color: var(--alert-red);
}

.remove-storage-btn {
    background: var(--alert-red);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.remove-storage-btn:hover {
    background: #c41e3a;
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.additional-memory {
    position: relative;
    margin-top: 0.75rem;
    padding-left: 1rem;
    border-left: 3px solid transparent;
    transition: var(--transition-smooth);
}

.additional-memory.filled {
    border-left-color: var(--gigantti-green);
}

.additional-memory.error {
    border-left-color: var(--alert-red);
}

.remove-memory-btn {
    background: var(--alert-red);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.remove-memory-btn:hover {
    background: #c41e3a;
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.additional-storage input.component-input,
.additional-memory input.component-input {
    flex: 1;
    min-width: 0;
}

.compatibility-sidebar {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(120, 190, 32, 0.1);
}

.sidebar-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-neutral);
}

.sidebar-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.mode-toggle {
    display: flex;
    background: var(--bg-section);
    border-radius: var(--radius-sm);
    padding: 4px;
    border: 1px solid var(--border-neutral);
}

.mode-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-light);
    border-radius: calc(var(--radius-sm) - 4px);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition-fast);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mode-btn.active {
    background: var(--gigantti-green);
    color: white;
    transform: scale(1.02);
    box-shadow: var(--shadow-sm);
}

.mode-btn:hover:not(.active) {
    background: rgba(120, 190, 32, 0.1);
    color: var(--gigantti-green);
}

.build-summary {
    margin-bottom: 1.5rem;
}

.summary-item {
    padding: 0.875rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    background: var(--bg-section);
    border: 1px solid var(--border-neutral);
    transition: var(--transition-fast);
}

.summary-item:hover {
    transform: translateX(2px);
    box-shadow: var(--shadow-sm);
}

.summary-item.empty {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    border-style: dashed;
    padding: 1.5rem;
}

.summary-item strong {
    color: var(--gigantti-blue);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-item span {
    font-size: 13px;
    color: var(--text-dark);
    font-weight: 500;
}

.compatibility-status {
    background: linear-gradient(135deg, var(--bg-section) 0%, #f0f4f8 100%);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-neutral);
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.status-item:last-child {
    margin-bottom: 0;
}

.status-label {
    font-weight: 500;
    color: var(--text-light);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-value {
    font-weight: 600;
    font-size: 14px;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    transition: var(--transition-fast);
}

.status-value.compatible {
    background: rgba(120, 190, 32, 0.1);
    color: var(--gigantti-green);
    border: 1px solid rgba(120, 190, 32, 0.2);
}

.status-value.incompatible {
    background: rgba(226, 0, 0, 0.1);
    color: var(--alert-red);
    border: 1px solid rgba(226, 0, 0, 0.2);
}

.status-value.pending {
    background: rgba(153, 153, 153, 0.1);
    color: var(--text-muted);
    border: 1px solid rgba(153, 153, 153, 0.2);
}

.suggestions-panel, .issues-panel {
    background: linear-gradient(135deg, var(--bg-section) 0%, #f0f4f8 100%);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--gigantti-green);
    border: 1px solid var(--border-neutral);
}

.issues-panel {
    border-left-color: var(--alert-red);
}

.suggestions-panel h4, .issues-panel h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
}

.issue-critical, .issue-warning {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.issue-critical {
    background: rgba(226, 0, 0, 0.08);
    color: #c41e3a;
    border-left: 3px solid var(--alert-red);
    font-weight: 500;
}

.issue-warning {
    background: rgba(255, 165, 0, 0.08);
    color: #b8860b;
    border-left: 3px solid #e6a200;
}

#smart-suggestions > div {
    padding: 0.375rem 0;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-light);
    border-bottom: 1px solid var(--border-neutral);
}

#smart-suggestions > div:last-child {
    border-bottom: none;
}

.suggestions-panel ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.suggestions-panel li {
    padding: 0.5rem 0;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-light);
}


.actions-panel {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-neutral);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.build-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.primary-btn {
    background: linear-gradient(135deg, var(--gigantti-green) 0%, #6ba91c 100%);
    color: white;
    border: none;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.primary-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: var(--transition-smooth);
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.primary-btn:hover:not(:disabled)::before {
    left: 100%;
}

.primary-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.secondary-btn {
    background: transparent;
    color: var(--gigantti-green);
    border: 2px solid var(--gigantti-green);
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.secondary-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: var(--gigantti-green);
    transition: var(--transition-fast);
    z-index: -1;
}

.secondary-btn:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.secondary-btn:hover::before {
    width: 100%;
}

.footer {
    background: var(--bg-section);
    color: var(--text-light);
    padding: 0.75rem 2rem;
    position: relative;
    border-top: 1px solid var(--border-neutral);
    margin-top: auto;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gigantti-green);
}

.footer-content {
    font-size: 11px;
    opacity: 0.8;
    text-align: center;
    max-width: 1200px;
    margin: 0 auto;
    font-weight: 400;
    letter-spacing: 0.02em;
}

.footer a {
    color: var(--gigantti-green);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-fast);
    border-bottom: 1px solid transparent;
    padding: 0 2px;
}

.footer a:hover {
    border-bottom-color: var(--gigantti-green);
    opacity: 1;
}

body.dragging::after {
    content: "Pudota JSON-tiedosto tähän tuodaksesi kokoonpano";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(120, 190, 32, 0.95);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    z-index: 1000;
    pointer-events: none;
    backdrop-filter: blur(8px);
}

@media (max-width: 1024px) {
    .build-interface {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .compatibility-sidebar {
        position: static;
        order: -1;
        border-radius: var(--radius-md);
    }
    
    .component-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .main {
        padding: 1rem;
    }
    
    .header {
        padding: 0.75rem 1rem;
        background: var(--white);
    }
    
    .header-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .author-info {
        width: 100%;
        justify-content: space-between;
    }
    
    .author-info h1 {
        font-size: 16px;
        color: var(--text-dark);
    }
    
    .disclaimer {
        font-size: 9px;
        padding: 0.15rem 0.5rem;
    }
    
    .subtitle {
        font-size: 11px;
        margin-top: 0;
        text-align: left;
        width: 100%;
        color: var(--text-light);
    }
    
    .footer {
        padding: 0.5rem 1rem;
        background: var(--bg-section);
    }
    
    .footer-content {
        font-size: 10px;
        color: var(--text-light);
    }
    
    .build-actions {
        display: none !important;
    }
    
    .actions-panel {
        padding-top: 0;
        border-top: none;
        position: static;
        background: transparent;
        box-shadow: none;
        z-index: auto;
    }
    
    .main {
        padding-bottom: 2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-contrast: high) {
    :root {
        --border-neutral: #666666;
        --text-muted: #666666;
    }
}

button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--gigantti-green);
    outline-offset: 2px;
}

.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

.component-card:active {
    transform: scale(0.98);
}

.primary-btn:active,
.secondary-btn:active {
    transform: translateY(0) scale(0.98);
}
