/* General Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Bricolage Grotesque', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

/* Input Section - New Minimalistic Design */
#input-section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.input-hero {
    text-align: center;
    margin-bottom: 40px;
}

.brand-logo {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 6px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 12px;
}

.input-hero h1 {
    font-size: 42px;
    font-weight: 700;
    color: white;
    margin-bottom: 12px;
    letter-spacing: -1px;
}

.input-hero .subtitle {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
}

.input-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Input Toggle */
.input-toggle {
    display: flex;
    background: #f3f4f6;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 32px;
}

.toggle-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: transparent;
    color: #6b7280;
    transition: all 0.2s ease;
    font-family: inherit;
}

.toggle-btn:hover {
    color: #374151;
}

.toggle-btn.active {
    background: white;
    color: #111827;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toggle-icon {
    display: flex;
    align-items: center;
}

.toggle-icon svg {
    width: 18px;
    height: 18px;
}

/* Input Content */
.input-content {
    display: none;
}

.input-content.active {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Share Code Input */
.code-input-wrapper {
    width: 100%;
    margin-bottom: 24px;
    text-align: center;
}

#sharecode-input {
    width: 100%;
    max-width: 280px;
    padding: 20px;
    font-size: 32px;
    text-align: center;
    letter-spacing: 8px;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    text-transform: uppercase;
    background: #f9fafb;
    color: #111827;
    transition: all 0.2s ease;
}

#sharecode-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

#sharecode-input::placeholder {
    font-size: 24px;
    letter-spacing: 6px;
    color: #d1d5db;
}

.input-hint {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: #9ca3af;
}

/* JSON Input */
#json-input {
    width: 100%;
    height: 200px;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    resize: vertical;
    margin-bottom: 24px;
    background: #f9fafb;
    color: #374151;
    transition: all 0.2s ease;
}

#json-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

#json-input::placeholder {
    color: #9ca3af;
}

/* Primary Button */
.primary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 280px;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transition: all 0.2s ease;
    font-family: inherit;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(102, 126, 234, 0.5);
}

.primary-btn:active {
    transform: translateY(0);
}

.primary-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.primary-btn svg {
    transition: transform 0.2s ease;
}

.primary-btn:hover svg {
    transform: translateX(4px);
}

/* Status Area */
.status-area {
    margin-top: 20px;
    text-align: center;
    min-height: 24px;
}

.error {
    color: #ef4444;
    font-size: 14px;
    font-weight: 500;
}

.loading {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #667eea;
    font-size: 14px;
    font-weight: 500;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #e5e7eb;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Print Button */
.print-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 24px;
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 500;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
    font-family: inherit;
}

.print-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* SVG text styling */
svg text {
    font-family: 'Bricolage Grotesque', sans-serif;
}

/* Legacy button styles for backwards compatibility */
button {
    font-family: inherit;
}

/* Page Styles */
.page {
    width: 210mm;
    min-height: 297mm;
    padding: 15mm;
    margin: 20px auto;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #2c3e50;
    margin-bottom: 20px;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #2c3e50;
    letter-spacing: 2px;
}

.doc-title {
    font-size: 18px;
    color: #666;
}

.doc-info {
    text-align: right;
    font-size: 12px;
    color: #666;
}

.doc-info span {
    display: block;
}

.page-content h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.page-footer {
    position: absolute;
    bottom: 15mm;
    left: 15mm;
    right: 15mm;
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #999;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

/* Drawing Container */
.drawing-container {
    display: flex;
    gap: 30px;
}

.diagram-section {
    flex: 1;
    min-width: 250px;
}

.diagram {
    border: 1px solid #ddd;
    background: #fafafa;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

.diagram-label {
    text-align: center;
    margin-top: 10px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.specs-section {
    flex: 1;
    min-width: 250px;
}

/* Cover Page Styles */
.page-cover {
    display: flex;
    flex-direction: column;
}

.cover-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.cover-logo {
    font-size: 48px;
    font-weight: 800;
    color: #2c3e50;
    letter-spacing: 8px;
    margin-bottom: 10px;
}

.cover-title {
    font-size: 24px;
    color: #666;
    margin-bottom: 20px;
    font-weight: 300;
}

/* 3D Viewer Styles */
.viewer-3d-container {
    width: 100%;
    max-width: 500px;
    height: 400px;
    position: relative;
    margin: 20px auto;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.viewer-3d {
    width: 100%;
    height: 100%;
}

.viewer-3d canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.viewer-3d-static {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #f5f5f5;
}

.viewer-controls {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
}

.viewer-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.viewer-btn:hover {
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.diagram-cover {
    min-height: 500px;
    max-height: 550px;
    width: 100%;
    border: none;
    background: transparent;
}

.diagram-cover svg {
    max-width: 100%;
    max-height: 530px;
}

.cover-info {
    margin-top: 40px;
}

.cover-code {
    font-size: 18px;
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 8px;
}

.cover-date {
    font-size: 14px;
    color: #666;
}

/* Full width diagram layout */
.diagram-full {
    width: 100%;
    margin-bottom: 20px;
}

.diagram-large {
    min-height: 450px;
    max-height: 500px;
}

.diagram-large svg {
    max-width: 100%;
    max-height: 480px;
}

/* Half height diagram layout for stacked SVGs */
.diagram-half {
    width: 100%;
    margin-bottom: 10px;
}

.diagram-medium {
    min-height: 280px;
    max-height: 300px;
}

.diagram-medium svg {
    max-width: 100%;
    max-height: 280px;
}

/* Specs tables row */
.specs-row {
    display: flex;
    gap: 20px;
}

.specs-table-half {
    flex: 1;
}

/* Specs Table */
.specs-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.specs-table th,
.specs-table td {
    padding: 10px 12px;
    text-align: left;
    border: 1px solid #ddd;
}

.specs-table th {
    background: #2c3e50;
    color: white;
    font-weight: 600;
}

.specs-table tr:nth-child(even) {
    background: #f9f9f9;
}

.specs-table td:first-child {
    font-weight: 500;
    color: #555;
    width: 40%;
}

/* Sections Info */
.sections-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.sections-info h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 14px;
}

.section-item {
    background: white;
    padding: 10px;
    margin: 8px 0;
    border-radius: 4px;
    border-left: 3px solid #3498db;
}

.section-item strong {
    color: #2c3e50;
}

/* Door List */
#doors-list {
    max-height: 500px;
    overflow-y: auto;
}

.door-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.door-section h4 {
    color: #2c3e50;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ddd;
}

.door-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.door-item:last-child {
    border-bottom: none;
}

.door-type {
    font-weight: 500;
    color: #333;
}

.door-color {
    color: #666;
    font-style: italic;
}

.door-none {
    color: #999;
}

.hambalan-info {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

/* Tambahan List */
#tambahan-list {
    max-height: 500px;
    overflow-y: auto;
}

.tambahan-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.tambahan-section h4 {
    color: #2c3e50;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ddd;
}

.tambahan-space {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.tambahan-space:last-child {
    border-bottom: none;
}

.space-label {
    font-weight: 500;
    color: #555;
    margin-bottom: 4px;
}

.tambahan-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tambahan-tag {
    background: #3498db;
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.tambahan-none {
    color: #999;
    font-style: italic;
}

/* When drawing pages are visible, reset body background */
body.drawing-mode {
    background: #f5f5f5;
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    .no-print {
        display: none !important;
    }

    .page {
        margin: 0;
        padding: 10mm;
        box-shadow: none;
        page-break-after: always;
    }

    .page:last-child {
        page-break-after: auto;
    }

    #drawing-pages {
        display: block !important;
    }
}

@page {
    size: A4;
    margin: 0;
}
