/* Calculator Page Styles */

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

/* Auction Details - Full Width Top */
.auction-details-top {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.auction-details-top h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: #333;
}

/* Car Name Input Row */
.car-name-input-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.car-name-input-row input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.car-name-input-row input:focus {
    outline: none;
    border-color: #007bff;
}

/* Image Upload */
.image-upload-group {
    min-width: 200px;
    max-width: 250px;
}

.image-upload-group .hint {
    font-weight: normal;
    font-size: 11px;
    color: #888;
}

.image-upload-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.image-upload-wrapper input[type="file"] {
    font-size: 12px;
    padding: 6px;
    border: 1px dashed #ccc;
    border-radius: 4px;
    background: #f9f9f9;
    cursor: pointer;
}

.image-upload-wrapper input[type="file"]:hover {
    border-color: #007bff;
    background: #f0f7ff;
}

.image-preview {
    width: 100%;
    max-height: 80px;
    border-radius: 4px;
    overflow: hidden;
    display: none;
}

.image-preview.has-image {
    display: block;
}

.image-preview img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.image-preview .remove-image {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
}

.image-preview img {
    cursor: pointer;
    transition: opacity 0.2s;
}

.image-preview img:hover {
    opacity: 0.8;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.lightbox.active {
    display: flex;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.lightbox-close:hover {
    color: #ccc;
}

.auction-details-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
}

.auction-details-grid .form-group {
    margin-bottom: 0;
}

.auction-details-grid .form-group-wide {
    grid-column: span 2;
}

.auction-details-grid label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
}

.auction-details-grid input,
.auction-details-grid select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.auction-details-grid input:focus,
.auction-details-grid select:focus {
    outline: none;
    border-color: #007bff;
}

@media (max-width: 1100px) {
    .auction-details-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .auction-details-grid .form-group-wide {
        grid-column: span 3;
    }
}

@media (max-width: 600px) {
    .auction-details-grid {
        grid-template-columns: 1fr 1fr;
    }
    .auction-details-grid .form-group-wide {
        grid-column: span 2;
    }
}

.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .calculator-grid {
        grid-template-columns: 1fr;
    }
}

.calc-section {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.section-header h2 {
    margin: 0;
    font-size: 16px;
}

.parts-count {
    color: #666;
    font-size: 14px;
}

.parts-filter-info {
    color: #007bff;
    font-size: 13px;
    font-weight: 500;
}

/* Filter Row */
.filter-row, .search-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.filter-row select, .search-row select, .search-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.filter-row select:focus, .search-row select:focus, .search-row input:focus {
    outline: none;
    border-color: #007bff;
}

/* Parts List */
.parts-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 4px;
}

.part-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

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

.part-item:hover {
    background: #f8f9fa;
}

.part-item.selected {
    background: #e3f2fd;
}

.part-info {
    flex: 1;
}

.part-name {
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 2px;
}

.part-meta {
    font-size: 12px;
    color: #666;
}

.part-price {
    font-weight: 600;
    color: #28a745;
    font-size: 14px;
    margin-left: 10px;
}

.part-add {
    padding: 4px 10px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 10px;
}

.part-add:hover {
    background: #0056b3;
}

/* Part Edit Button */
.part-edit-btn {
    padding: 4px 8px;
    background: #f8f9fa;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.2s;
}

.part-edit-btn:hover {
    background: #e9ecef;
    color: #333;
    border-color: #adb5bd;
}

/* Selected Parts */
.selected-parts {
    min-height: 150px;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 4px;
    margin-bottom: 15px;
}

.selected-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
}

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

.selected-info {
    flex: 1;
}

.selected-name {
    font-size: 14px;
    font-weight: 500;
}

.selected-meta {
    font-size: 12px;
    color: #666;
}

.selected-price {
    font-weight: 600;
    font-size: 14px;
    margin: 0 15px;
}

.selected-remove {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0 5px;
}

.selected-remove:hover {
    color: #a71d2a;
}

/* Paint Option (for Body parts) */
.paint-option {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed #ddd;
}

.paint-checkbox {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #666;
}

.paint-checkbox input[type="checkbox"] {
    margin: 0;
    width: auto;
}

.paint-select {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    max-width: 200px;
}

.paint-select:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.paint-select:focus {
    outline: none;
    border-color: #007bff;
}

/* Paint price indicator next to part price */
.paint-price-added {
    color: #856404;
    font-size: 12px;
    font-weight: normal;
}

/* Paint Total Row */
.total-row.paint-total {
    background: #fff3cd;
    margin-bottom: 15px;
}

.total-row.paint-total .total-amount {
    color: #856404;
}

/* Total Row */
.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 20px;
    font-weight: 600;
}

.total-amount {
    font-size: 20px;
    color: #28a745;
}

/* Expenses Sections (Services & Fees) */
.expenses-section {
    margin-bottom: 15px;
    border: 1px solid #eee;
    border-radius: 4px;
}

.expenses-section .section-header {
    padding: 10px 15px;
    margin-bottom: 0;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.expenses-section .section-header h3 {
    margin: 0;
    font-size: 14px;
}

.section-total {
    margin-left: auto;
    font-weight: 600;
    color: #dc3545;
}

.expense-items {
    max-height: 150px;
    overflow-y: auto;
}

.expense-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
}

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

.expense-item input[type="checkbox"] {
    margin-right: 10px;
    width: auto;
}

.expense-item label {
    flex: 1;
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
}

.expense-item .expense-name {
    flex: 1;
}

.expense-item .expense-cost {
    width: 100px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: right;
    font-size: 13px;
}

.expense-item .expense-cost:focus {
    outline: none;
    border-color: #007bff;
}

.expenses-total {
    background: #fff3cd;
    border: 1px solid #ffc107;
}

.expenses-total .total-amount {
    color: #856404;
}

/* Fees Section at Bottom */
.fees-section-bottom {
    margin-top: 20px;
}

/* Auction Details */
.auction-details {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

.auction-details h3 {
    font-size: 14px;
    margin-bottom: 15px;
    color: #333;
}

.auction-details .form-group {
    margin-bottom: 12px;
}

.auction-details .form-group:last-child {
    margin-bottom: 0;
}

.auction-details label {
    font-size: 12px;
    color: #666;
}

.auction-details input {
    padding: 8px 10px;
    font-size: 14px;
}

/* Calculation Results */
.calculation-results {
    margin-bottom: 20px;
}

.calculation-results h3 {
    font-size: 14px;
    margin-bottom: 10px;
    color: #333;
}

.calc-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.calc-table th, .calc-table td {
    padding: 12px 15px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

.calc-table th {
    background: #f8f9fa;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
    color: #666;
}

.calc-table td {
    font-size: 14px;
}

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

.calc-table .max-bid {
    font-weight: 700;
    font-size: 16px;
    color: #007bff;
}

.calc-table .max-bid.negative {
    color: #dc3545;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.action-buttons .btn {
    flex: 1;
    padding: 12px;
    font-size: 14px;
}

/* Empty State */
.selected-parts .empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

.parts-list .empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.notification.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.notification.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active { display: flex; }

.modal-content {
    background: #fff;
    border-radius: 8px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 5px 30px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 { font-size: 18px; margin: 0; }

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    line-height: 1;
}

.modal-close:hover { color: #333; }

.modal-body { padding: 20px; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #eee;
}

/* Form elements in modal */
.modal .form-group {
    margin-bottom: 15px;
}

.modal .form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 14px;
}

.modal .form-group input,
.modal .form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.modal .form-group input:focus,
.modal .form-group select:focus {
    outline: none;
    border-color: #007bff;
}

.modal .form-row {
    display: flex;
    gap: 15px;
}

.modal .form-row .form-group { flex: 1; }

/* Selected car info */
.selected-car-info {
    padding: 10px 12px;
    background: #e3f2fd;
    border-radius: 4px;
    font-size: 14px;
    color: #1565c0;
}

.selected-car-info .car-label {
    font-weight: 500;
}

/* ===========================================
   CALCULATOR PAGE - MOBILE STYLES
   =========================================== */

@media (max-width: 768px) {
    /* Car name input row stacks */
    .car-name-input-row {
        flex-direction: column;
    }

    .image-upload-group {
        min-width: 100%;
        max-width: 100%;
    }

    /* Auction details grid */
    .auction-details-grid {
        grid-template-columns: 1fr 1fr;
    }

    .auction-details-grid .form-group-wide {
        grid-column: span 2;
    }

    /* Search/Filter row stacks */
    .search-row, .filter-row {
        flex-direction: column;
    }

    .search-row input,
    .search-row select,
    .filter-row select {
        width: 100%;
    }

    /* Parts list taller on mobile */
    .parts-list {
        max-height: 300px;
    }

    /* Part items touch-friendly */
    .part-item {
        padding: 12px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .part-info {
        min-width: 60%;
    }

    .part-price {
        margin-left: 0;
    }

    .part-add {
        margin-left: auto;
        padding: 8px 16px;
    }

    /* Selected items */
    .selected-item {
        flex-wrap: wrap;
        gap: 8px;
    }

    .selected-info {
        width: 100%;
    }

    .selected-price {
        margin: 0;
    }

    /* Total rows */
    .total-row {
        flex-direction: column;
        text-align: center;
        gap: 5px;
    }

    .total-row span:first-child {
        font-size: 13px;
    }

    /* Expense items */
    .expense-item {
        flex-wrap: wrap;
        gap: 8px;
    }

    .expense-item label {
        width: calc(100% - 30px);
    }

    .expense-item .expense-cost {
        width: 100%;
        margin-top: 5px;
    }

    /* Calc table responsive - card style */
    .calc-table {
        display: block;
        border: none;
    }

    .calc-table thead {
        display: none;
    }

    .calc-table tbody {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .calc-table tr {
        display: flex;
        flex-wrap: wrap;
        background: #f8f9fa;
        border-radius: 8px;
        padding: 12px;
        border: 1px solid #eee;
    }

    .calc-table td {
        padding: 4px 0;
        border: none;
        text-align: left;
    }

    .calc-table td:first-child {
        width: 100%;
        font-weight: 600;
        color: #666;
        font-size: 12px;
        text-transform: uppercase;
        margin-bottom: 5px;
    }

    .calc-table td:nth-child(2) {
        flex: 1;
    }

    .calc-table td:nth-child(3) {
        text-align: right;
    }

    .calc-table .max-bid {
        font-size: 18px;
    }

    /* Action buttons stack */
    .action-buttons {
        flex-direction: column;
    }

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

    /* Modal adjustments */
    .modal-content {
        margin: 10px;
        max-width: calc(100% - 20px);
    }

    .modal .form-row {
        flex-direction: column;
        gap: 0;
    }

    /* Notification */
    .notification {
        left: 10px;
        right: 10px;
        top: 10px;
    }
}

@media (max-width: 480px) {
    /* Even smaller screens */
    .auction-details-grid {
        grid-template-columns: 1fr;
    }

    .auction-details-grid .form-group-wide {
        grid-column: span 1;
    }

    .calc-section {
        padding: 15px;
    }

    .section-header {
        flex-wrap: wrap;
    }

    .section-header h2 {
        font-size: 14px;
    }

    .parts-count {
        font-size: 12px;
    }

    /* Paint option stacks */
    .paint-option {
        flex-direction: column;
        align-items: flex-start;
    }

    .paint-select {
        max-width: 100%;
        width: 100%;
    }
}
