/* KLIMAMONT - Google Material Design UI */

:root {
    /* Colors (Google Material) */
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --primary-light: #e8f0fe;
    --secondary: #5f6368;
    --success: #1e8e3e;
    --warning: #f9ab00;
    --danger: #d93025;
    
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --border: #dadce0;
    
    /* Typography */
    --font-heading: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-body: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-mono: 'Roboto Mono', 'Fira Mono', monospace;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Material Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
    --shadow-md: 0 1px 3px 0 rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15);
    --shadow-lg: 0 4px 6px 0 rgba(60,64,67,0.3), 0 8px 24px 3px rgba(60,64,67,0.15);
    
    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Standard Radii */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* RESET & BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 500;
    line-height: 1.2;
    color: var(--text-primary);
}

/* VIEW SYSTEM */
.view {
    display: none;
    min-height: 100vh;
}

.view.active {
    display: flex;
    flex-direction: column;
}

/* LOGIN PAGE */
.login-page {
    background: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
}

.login-container {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 40px 32px;
    max-width: 450px;
    width: 100%;
    border: 1px solid var(--border);
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.section-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   gap: 10px;
}
.login-brand {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.login-brand h1 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 400;
}

.login-brand p {
    color: var(--text-secondary);
    font-size: 16px;
}

.login-form {
    margin-bottom: var(--spacing-lg);
}

.login-footer {
    text-align: center;
    padding-top: var(--spacing-lg);
    font-size: 14px;
    color: var(--text-secondary);
}

/* FORMS */
.form-group {
    margin-bottom: var(--spacing-lg);
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-family: var(--font-body);
    transition: all var(--transition-base);
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

.form-section {
    margin-bottom: var(--spacing-xl);
}

.form-section h3 {
    font-size: 18px;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 24px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.25px;
    cursor: pointer;
    transition: background-color var(--transition-base), box-shadow var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
}

.btn-large {
    width: 100%;
    height: 48px;
    font-size: 16px;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--secondary);
    cursor: pointer;
    transition: background-color var(--transition-base);
}

.btn-icon:hover {
    background: rgba(95,99,104, 0.08);
}

/* HEADER */
.app-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 2px 0 rgba(60,64,67,0.1);
}

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

.header-left h1 {
    font-size: 22px;
    font-weight: 400;
    color: var(--secondary);
}

.logo-mini {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 18px;
}

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

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--secondary);
}

/* MAIN CONTENT */
.app-main {
    flex: 1;
    padding: 24px;
    padding-bottom: 80px; /* Space for mobile nav */
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.dashboard-header h2 {
    font-size: 24px;
    font-weight: 400;
}

/* PROJECT GRID */
.project-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.project-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: box-shadow var(--transition-base), border var(--transition-base);
}

.project-card:hover {
    box-shadow: var(--shadow-md);
}

.project-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.project-header h3 {
    font-size: 18px;
    font-weight: 500;
}

.project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--secondary);
}

.meta-item.weight {
    color: var(--text-primary);
    font-weight: 500;
}

.project-zones {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.zone-tag {
    padding: 2px 8px;
    background: #f1f3f4;
    border-radius: 12px;
    font-size: 12px;
    color: var(--secondary);
    font-weight: 500;
}

/* BADGES */
.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-success { background: #e6f4ea; color: #137333; }
.badge-warning { background: #fef7e0; color: #b06000; }
.badge-draft { background: #f1f3f4; color: #5f6368; }
.badge-submitted { background: var(--primary-light); color: var(--primary-dark); }

/* STATS */
.project-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 400;
    color: var(--primary);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--secondary);
}

/* FILTERS */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.filter-select {
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%235f6368%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 12px top 50%;
    background-size: 10px auto;
}

.filter-select:hover {
    background-color: var(--bg-primary);
}

/* PARTS LIST */
.parts-list {
    display: grid;
    gap: 16px;
}

.part-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: box-shadow var(--transition-base);
}

.part-card:hover {
    box-shadow: var(--shadow-sm);
}

.part-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.part-header h3 {
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.part-shape {
    font-size: 12px;
    font-weight: 400;
    color: var(--secondary);
    background: #f1f3f4;
    padding: 2px 8px;
    border-radius: 4px;
}

.part-label {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--secondary);
    margin-top: 4px;
}

.part-dimensions {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: var(--radius-sm);
}

.dim-item {
    display: flex;
    flex-direction: column;
}

.dim-label {
    font-size: 11px;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dim-value {
    font-size: 14px;
    font-weight: 500;
}

.part-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.part-info {
    display: flex;
    gap: 24px;
}

.info-item {
    display: flex;
    flex-direction: column;
    font-size: 13px;
}

.info-item span {
    color: var(--secondary);
}

.info-item strong {
    font-weight: 600;
    font-size: 15px;
}

.info-item.weight-highlight strong {
    color: var(--primary-dark);
}

/* SCHEMAS */
#partSchemaPreview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    background: #f1f3f4;
    border-radius: var(--radius-md);
    margin: var(--spacing-sm) 0;
    padding: var(--spacing-md);
}

#partSchemaPreview svg {
    max-height: 100px;
    max-width: 100%;
}

/* MODAL */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(32,33,36, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

.modal-large {
    max-width: 800px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 10;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 400;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.part-form {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: #f8f9fa;
    position: sticky;
    bottom: 0;
}

/* CALCULATION RESULTS */
.calculation-results {
    display: flex;
    gap: 24px;
    padding: 16px 20px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    border: 1px solid #d2e3fc;
}

.calc-item {
    display: flex;
    flex-direction: column;
}

.calc-label {
    font-size: 12px;
    color: var(--secondary);
}

.calc-value {
    font-size: 16px;
    font-weight: 500;
    color: var(--primary-dark);
}

.calc-item.highlight .calc-value {
    font-size: 20px;
    font-weight: 700;
}

/* MOBILE NAV */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 8px 12px;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--secondary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    width: 64px;
    height: 48px;
    justify-content: center;
    border-radius: 12px;
}

.nav-item.active {
    color: var(--primary);
}
.nav-item.active svg {
    fill: var(--primary-light);
}

/* TOAST NOTIFICATIONS */
.toast-container {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: #323232;
    color: white;
    padding: 14px 24px;
    border-radius: 4px;
    font-size: 14px;
    box-shadow: var(--shadow-md);
    min-width: 288px;
    text-align: center;
    animation: slideUpToast 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.error-message {
    padding: 12px 16px;
    background: #fce8e6;
    border: 1px solid #fad2cf;
    border-radius: var(--radius-sm);
    color: var(--danger);
    font-size: 14px;
    margin-top: 16px;
}

/* RESPONSIVE */
@media (min-width: 640px) {
    .toast-container {
        bottom: 24px;
    }
}

@media (min-width: 768px) {
    .mobile-nav {
        display: none;
    }
    
    .app-main {
        padding-bottom: 24px;
    }
}
