@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=Outfit:wght@400;600;800&display=swap');

:root {
    --bg-color: #0d1117;
    --surface-color: #161b22;
    --surface-hover: #21262d;
    --accent-color: #bba078;
    --accent-glow: rgba(187, 160, 120, 0.3);
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Box Generator specific variables */
    --panel-bg: rgba(22, 27, 34, 0.6);
    --border-color: rgba(255, 255, 255, 0.1);
    --cut-line: #ff3e3e;
    --fold-line: #3e7eff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar Style (Replicated from North UP) */
.navbar {
    background: rgba(13, 17, 23, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-img {
    height: 48px;
    width: auto;
    mix-blend-mode: screen;
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.25rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.logo-text span {
    color: var(--accent-color);
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
}

.nav-links a:hover {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

/* App Content Layout */
.app-container {
    flex: 1;
    max-width: 1400px;
    margin: 4rem auto;
    padding: 0 2rem;
    width: 100%;
}

.page-header {
    text-align: center;
    margin-bottom: 4rem;
}

.page-header h1 {
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    letter-spacing: -2px;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.page-header h1 span {
    color: var(--accent-color);
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1.25rem;
    font-weight: 300;
    max-width: 700px;
    margin: 0 auto;
}

/* Main Grid Layout */
main {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 3rem;
    align-items: start;
}

/* Control Panel (Service Card Style) */
.controls-panel {
    background: rgba(22, 27, 34, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 3rem 2.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 2rem;
    transition: var(--transition);
}

.controls-panel:hover {
    transform: translateY(-8px);
    border-color: rgba(187, 160, 120, 0.35);
    box-shadow: 0 20px 40px rgba(0,0,0,0.8), 0 0 30px rgba(187, 160, 120, 0.08);
}

.controls-panel h2 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-primary);
    font-weight: 500;
}

.input-grid {
    display: grid;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    position: relative;
}

.input-group label {
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.input-group input {
    background: var(--bg-color);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 1rem 1.25rem;
    border-radius: 2px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: var(--transition);
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(187, 160, 120, 0.25);
}

.unit {
    position: absolute;
    right: 1.25rem;
    top: 2.8rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    pointer-events: none;
    opacity: 0.6;
}

/* Primary Button Style */
.download-btn {
    background-color: var(--accent-color);
    color: #111 !important;
    padding: 1.2rem;
    border-radius: 2px;
    font-weight: 700;
    font-family: var(--font-body);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    margin-top: 1rem;
}

.download-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(187, 160, 120, 0.35);
    background-color: #c9ae88;
}

.download-btn svg {
    width: 20px;
    height: 20px;
}

/* Eelvaate ala (Kõrge kontrastsus ja disain) */
.preview-panel {
    background: #ffffff; /* Valge taust eelvaateks */
    border-radius: 4px;
    border: 1px solid var(--border-color);
    min-height: 700px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    /* Subtiilne ruudustik */
    background-image: 
        radial-gradient(#e5e7eb 1px, transparent 1px),
        radial-gradient(#e5e7eb 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

.preview-panel:hover {
    border-color: rgba(187, 160, 120, 0.3);
}

#svg-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    width: 100%;
}

/* 
   Dual-Mode Color Logic:
   Värvid on nüüd standardsed punased/sinised nii veebis kui failis.
*/
#svg-container svg {
    width: 100%;
    height: 100%;
    max-height: 600px;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.1));
}

/* Veateate kuvamine */
#error-display {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    right: 1.5rem;
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
    padding: 1rem 1.5rem;
    border-radius: 4px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    backdrop-filter: blur(12px);
    font-size: 0.95rem;
    z-index: 10;
    display: none;
}

/* Info ja omadused */
.info-bar {
    margin-top: 3rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.info-item {
    background: rgba(255,255,255,0.03);
    padding: 1.5rem;
    border-radius: 4px;
    border-left: 3px solid var(--accent-color);
}

.info-item h3 {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.info-item p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Legend (Uus hele teema) */
.legend {
    padding: 1.5rem 2.5rem;
    background: #f9fafb;
    display: flex;
    gap: 2.5rem;
    border-top: 1px solid #e5e7eb;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: #4b5563;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.dot-cut { background: red; }
.dot-fold { background: blue; }

/* Footer Style (Replicated from North UP) */
.footer {
    background: rgba(22, 27, 34, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 6rem 0 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 4rem;
    flex-wrap: wrap;
    gap: 4rem;
}

.footer-brand {
    max-width: 300px;
}

.footer-logo {
    height: 80px;
    width: auto;
    margin-bottom: 1.5rem;
    opacity: 0.9;
    mix-blend-mode: screen;
}

.footer-brand p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
}

.footer-links-group h4 {
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.footer-nav {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    list-style: none;
}

.footer-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.95rem;
}

.footer-nav a:hover {
    color: var(--accent-color);
}

.footer-bottom {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 2rem 0;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Animations */
@keyframes floatOrb {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-30px) scale(1.05); }
}

.page-header::before {
    content: ''; position: absolute; top: -100px; right: -50px; width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(187,160,120,0.05) 0%, rgba(13,17,23,0) 70%);
    filter: blur(40px); z-index: -1; border-radius: 50%;
    animation: floatOrb 10s ease-in-out infinite alternate; pointer-events: none;
}

/* Responsive */
@media (max-width: 1100px) {
    main {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .preview-panel {
        min-height: 500px;
    }
    .info-bar {
        grid-template-columns: 1fr;
    }
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 17, 23, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 1;
    transition: var(--transition);
}

.modal-content {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 3rem;
    max-width: 550px;
    width: 90%;
    border-radius: 4px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    animation: modalAppear 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-content h2 {
    font-family: var(--font-heading);
    color: var(--accent-color);
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
    font-weight: 700;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    font-size: 1rem;
    line-height: 1.6;
}

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

.modal-hidden {
    opacity: 0;
    pointer-events: none;
}

/* Hamburger Menu Styles imported for mobile view */
.hamburger {
    display: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
}
.hamburger span {
    width: 25px;
    height: 2px;
    background: var(--text-primary);
    transition: var(--transition);
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    .hamburger {
        display: flex;
    }
    .lang-switch {
        padding-right: 3rem;
    }
}
