/* Modern Shutter Order Page Styles */

.shutter-order-page {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
    background: #f5f7fa;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 4px;
}

.page-header .subtitle {
    color: #718096;
    font-size: 14px;
}

/* Section Styling */
.section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.section h2 {
    font-size: 18px;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 16px;
}

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

.section-header h2 {
    margin-bottom: 0;
}

/* Customer & Settings Grid */
.customer-grid,
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* Input Groups */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 13px;
    font-weight: 500;
    color: #4a5568;
}

.input-group input[type="text"],
.input-group input[type="number"],
.input-group select {
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
    background: white;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.input-group small {
    color: #a0aec0;
    font-size: 12px;
}

/* Radio Groups */
.radio-group {
    display: flex;
    gap: 12px;
    margin-top: 6px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: normal;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.2s;
}

.radio-group label:hover {
    background: #f7fafc;
}

.radio-group input[type="radio"] {
    cursor: pointer;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

/* Windows Section - Compact Grid */
.windows-section {
    background: transparent;
    padding: 0;
    box-shadow: none;
}

#windowsContainer {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

/* Compact Window Card */
.window-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s;
}

.window-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.window-card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.window-card-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.window-card-body {
    padding: 16px;
}

/* Compact Input Grid */
.window-card-body .input-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

/* Panel Configuration - Compact */
.panel-config {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
}

.auto-count {
    color: #48bb78;
    font-weight: 600;
}

.manual-panel-input {
    margin-top: 8px;
    max-width: 100px;
}

.tilt-bar-config {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

.tilt-bar-config > label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #4a5568;
}

.tilt-bars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}

.tilt-bar-panel {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: white;
    border-radius: 4px;
    font-size: 13px;
}

.tilt-bar-panel > label {
    font-weight: 500;
    min-width: 60px;
    font-size: 13px;
}

.radio-group-inline {
    display: flex;
    gap: 8px;
}

.radio-group-inline label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 13px;
}

/* Advanced Options - Compact */
.advanced-options {
    margin: 12px 0;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

.advanced-options summary {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #667eea;
    background: #f7fafc;
    border-radius: 6px;
    user-select: none;
    transition: background 0.2s;
}

.advanced-options summary:hover {
    background: #edf2f7;
}

.advanced-options[open] summary {
    border-radius: 6px 6px 0 0;
}

.advanced-options .input-grid {
    padding: 12px;
    gap: 10px;
}

/* Buttons - Modern */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.btn-success:hover {
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
}

.btn-danger {
    background: #fc8181;
    color: white;
}

.btn-danger:hover {
    background: #f56565;
}

.btn-secondary {
    background: #cbd5e0;
    color: #2d3748;
}

.btn-secondary:hover {
    background: #a0aec0;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.calculate-window-btn {
    width: 100%;
    justify-content: center;
    margin-top: 8px;
    font-size: 13px;
    padding: 8px;
}

/* Calculate All Button */
.calculate-all-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.calculate-all-section h3 {
    color: white;
    margin-bottom: 12px;
    font-size: 18px;
}

.btn-calculate-all {
    background: white;
    color: #667eea;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-calculate-all:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

/* Window Results - Compact */
.window-results {
    border-top: 1px solid #e2e8f0;
    padding: 16px;
    background: #f7fafc;
    margin-top: 12px;
}

.window-result-content h4 {
    font-size: 15px;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #667eea;
}

/* Dimensions Info */
.dimensions-info {
    background: #edf2f7;
    border-left: 4px solid #667eea;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 12px;
}

.dimension-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 13px;
}

.dim-label {
    font-weight: 600;
    color: #4a5568;
}

.dim-value {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 700;
    color: #2d3748;
    background: white;
    padding: 4px 12px;
    border-radius: 4px;
    border: 1px solid #cbd5e0;
}

/* Panel Diagram - Compact */
.panel-diagram {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.panel-box {
    border: 2px solid #667eea;
    border-radius: 6px;
    padding: 8px 12px;
    text-align: center;
    min-width: 60px;
    background: white;
}

.panel-label {
    font-size: 11px;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 4px;
}

.panel-tilt {
    font-size: 18px;
    font-weight: 700;
    color: #667eea;
}

/* Cutting Box - Compact */
.cutting-box {
    background: #fffbeb;
    border: 2px solid #f59e0b;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 12px;
}

.cutting-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
}

.cutting-label {
    font-weight: 500;
    color: #78350f;
}

.cutting-value {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 700;
    color: #92400e;
}

/* Parts Table - Compact */
.parts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    border-radius: 6px;
    overflow: hidden;
}

.parts-table th,
.parts-table td {
    padding: 8px 10px;
    text-align: left;
}

.parts-table thead {
    background: #667eea;
    color: white;
    font-weight: 600;
}

.parts-table tbody tr {
    border-bottom: 1px solid #e2e8f0;
}

.parts-table tbody tr:last-child {
    border-bottom: none;
}

.parts-table .section-header td {
    background: #edf2f7;
    font-weight: 600;
    color: #2d3748;
    font-size: 12px;
}

.parts-table tbody tr:hover:not(.section-header) {
    background: #f7fafc;
}

/* Results Section */
.results-section {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.overall-summary {
    background: #edf2f7;
    border-left: 4px solid #667eea;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 20px;
}

.overall-summary p {
    margin: 8px 0;
    font-size: 15px;
    color: #2d3748;
}

.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Error Messages */
.error-messages {
    background: #fff5f5;
    border-left: 4px solid #fc8181;
    border-radius: 6px;
    padding: 16px;
    margin: 20px 0;
    color: #742a2a;
}

.error-messages h3 {
    margin-top: 0;
    font-size: 16px;
    color: #c53030;
}

.error-messages ul {
    margin: 8px 0;
    padding-left: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .shutter-order-page {
        padding: 12px;
    }

    #windowsContainer {
        grid-template-columns: 1fr;
    }

    .customer-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .page-header h1 {
        font-size: 22px;
    }

    .section {
        padding: 16px;
    }

    .tilt-bars-grid {
        grid-template-columns: 1fr;
    }
}

/* Header Content with Button */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.header-content > div {
    flex: 1;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.2s ease-out;
}

.modal-content.modal-large {
    max-width: 1200px;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

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

/* Orders Table */
.orders-table-container {
    overflow-x: auto;
}

.orders-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.orders-table th,
.orders-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.orders-table thead {
    background: #f7fafc;
    position: sticky;
    top: 0;
}

.orders-table th {
    font-weight: 600;
    color: #2d3748;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.orders-table tbody tr {
    transition: background 0.2s;
}

.orders-table tbody tr:hover {
    background: #f7fafc;
}

.orders-table tbody tr:last-child td {
    border-bottom: none;
}

/* Action Buttons Inline */
.action-buttons-inline {
    display: flex;
    gap: 8px;
}

.action-buttons-inline .btn {
    padding: 6px 10px;
}

/* Responsive Modal */
@media (max-width: 768px) {
    .modal {
        padding: 10px;
    }

    .modal-content.modal-large {
        max-width: 100%;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .orders-table {
        font-size: 12px;
    }

    .orders-table th,
    .orders-table td {
        padding: 8px;
    }
}
