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

html, body {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 16px;
}

.container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: visible;
    width: 100%;
    max-width: 500px;
    position: relative;
}

.edit-btn {
    position: absolute;
    top: -16px;
    left: -16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #22c55e;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
    transition: all 0.2s ease;
    z-index: 10;
}

.edit-btn:hover {
    background: #16a34a;
    transform: scale(1.1);
}

.edit-btn svg {
    width: 18px;
    height: 18px;
    fill: white;
}

.table-title {
    text-align: center;
    background: #667eea;
    color: white;
    font-weight: 650;
    font-size: 16px;
    padding: 12px 20px;
    border-radius: 12px 12px 0 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

td {
    padding: 16px 20px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

/* Item Section Styles */
.item-section {
    border-bottom: 1px solid #e5e7eb;
}

.item-section:last-of-type {
    border-bottom: none;
}

.item-section-cell {
    padding: 0 !important;
    border: none !important;
}

.item-top-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px 8px 16px;
}

.item-name {
    flex: 1;
    text-align: left;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.item-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.item-slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 16px 14px 16px;
}

.price-label {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    min-width: 40px;
}

.price-label.low {
    color: #22c55e;
    text-align: right;
}

.price-label.high {
    color: #ef4444;
    text-align: left;
}

.price-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #22c55e, #f59e0b, #ef4444);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.price-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s;
}

.price-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.price-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.current-price {
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
}

/* Disabled state for item section */
.item-section.disabled {
    opacity: 0.5;
}

.item-section.disabled .price-slider {
    pointer-events: none;
}

.item-section.disabled .count-select {
    pointer-events: none;
}

.count-select {
    width: 50px;
    padding: 8px 4px;
    text-align: center;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
    vertical-align: middle;
}

.toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 1;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d1d5db;
    transition: 0.2s;
    border-radius: 20px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.2s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #22c55e;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(16px);
}

/* Disabled row state */
.input-row.disabled {
    opacity: 0.5;
}

.input-row.disabled .item-name {
    color: #9ca3af;
}

.input-row.disabled select {
    pointer-events: none;
    background-color: #f3f4f6;
    color: #9ca3af;
}

select {
    padding: 10px 12px;
    font-size: 14px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
    outline: none;
    width: 100%;
    max-width: 180px;
}

select:hover {
    border-color: #999;
}

select:focus {
    border-color: #667eea;
}

/* Adjustment Row */
.adjustment-row td {
    background: #fafafa;
    color: #666;
    font-weight: 500;
    font-size: 14px;
    padding: 12px 16px;
    text-align: left;
}

.adjustment-row td:first-child {
    padding-left: 20px;
}

.adjustment-input-cell {
    text-align: right !important;
    padding-right: 20px !important;
}

.adjustment-input-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.adjustment-input-wrapper span {
    color: #999;
    font-size: 14px;
}

.adjustment-input-wrapper input {
    width: 70px;
    padding: 6px 8px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    text-align: right;
    outline: none;
    transition: border-color 0.2s;
}

.adjustment-input-wrapper input:focus {
    border-color: #667eea;
}

.result-row td {
    background: #f8f9fa;
    color: #667eea;
    font-weight: 600;
    font-size: 18px;
    border-bottom: none;
    border-radius: 0 0 12px 12px;
}

/* Mobile Styles */
@media (max-width: 480px) {
    body {
        padding: 12px;
        align-items: flex-start;
        padding-top: 100px;
        padding-bottom: 100px;
    }

    .container {
        border-radius: 8px;
    }

    .edit-btn {
        top: -10px;
        left: -10px;
        width: 36px;
        height: 36px;
    }

    .edit-btn svg {
        width: 16px;
        height: 16px;
    }

    td {
        padding: 14px 12px;
    }

    .item-top-row {
        padding: 12px 12px 6px 12px;
        gap: 10px;
    }

    .item-name {
        font-size: 13px;
    }

    .item-slider-row {
        padding: 4px 12px 12px 12px;
        gap: 8px;
    }

    .price-label {
        font-size: 10px;
        min-width: 32px;
    }

    .price-slider::-webkit-slider-thumb {
        width: 18px;
        height: 18px;
    }

    .price-slider::-moz-range-thumb {
        width: 18px;
        height: 18px;
    }

    .current-price {
        font-size: 12px;
    }

    .count-select {
        width: 42px;
        padding: 6px 2px;
    }

    .toggle-switch {
        width: 32px;
        height: 18px;
    }

    .toggle-slider:before {
        height: 12px;
        width: 12px;
    }

    .toggle-switch input:checked + .toggle-slider:before {
        transform: translateX(14px);
    }

    select {
        padding: 8px 10px;
        font-size: 13px;
    }

    .result-row td {
        font-size: 16px;
    }
}

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

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 600px;
    width: calc(100% - 32px);
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    margin: 16px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #eee;
}

.modal-header h2 {
    color: #333;
    font-size: 20px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

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

.edit-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    position: relative;
}

.edit-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.edit-item-header label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    display: none;
}

.edit-item-header input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
    min-width: 0;
}

.edit-item-header input:focus {
    outline: none;
    border-color: #667eea;
}

.delete-item-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fee2e2;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.delete-item-btn:hover {
    background: #ef4444;
}

.delete-item-btn:hover svg {
    fill: white;
}

.delete-item-btn svg {
    width: 16px;
    height: 16px;
    fill: #ef4444;
}

.price-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.price-grid-two {
    grid-template-columns: repeat(2, 1fr);
}

.price-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.price-input-group label {
    font-size: 11px;
    color: #666;
    font-weight: 500;
}

.price-input-group.low label { color: #22c55e; }
.price-input-group.medium label { color: #f59e0b; }
.price-input-group.high label { color: #ef4444; }

.price-input-wrapper {
    position: relative;
}

.price-input-wrapper::before {
    content: '$';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-weight: 500;
    font-size: 13px;
}

.price-input-wrapper input {
    width: 100%;
    padding: 8px 8px 8px 24px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.price-input-wrapper input:focus {
    outline: none;
    border-color: #667eea;
}

/* Mobile modal adjustments */
@media (max-width: 480px) {
    .modal {
        padding: 20px;
        border-radius: 12px;
        max-height: 90vh;
    }

    .modal-header {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }

    .modal-header h2 {
        font-size: 18px;
    }

    .edit-item {
        padding: 14px;
    }

    .edit-item-header input {
        padding: 8px 12px;
        font-size: 14px;
    }

    .price-grid {
        gap: 6px;
    }

    .price-input-wrapper input {
        padding: 8px 8px 8px 22px;
        font-size: 13px;
    }

    .price-input-wrapper::before {
        left: 8px;
        font-size: 12px;
    }

    .modal-actions {
        margin-top: 16px;
        padding-top: 16px;
    }

    .btn {
        padding: 12px 16px;
        font-size: 14px;
    }

    .add-item-btn {
        padding: 14px;
        font-size: 13px;
    }
}

.add-item-btn {
    width: 100%;
    padding: 16px;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    background: transparent;
    color: #6b7280;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.add-item-btn:hover {
    border-color: #22c55e;
    color: #22c55e;
    background: #f0fdf4;
}

.add-item-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px solid #eee;
}

.btn {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel {
    background: #f1f5f9;
    color: #64748b;
}

.btn-cancel:hover {
    background: #e2e8f0;
}

.btn-save {
    background: #22c55e;
    color: white;
}

.btn-save:hover {
    background: #16a34a;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
}

.empty-state p {
    margin-bottom: 16px;
}

/* Client Info Container */
.client-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 500px;
    padding: 20px;
}

.client-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.client-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.client-input-group label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.client-input-group input,
.client-input-group textarea {
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
    width: 100%;
    font-family: inherit;
    resize: vertical;
}

.client-input-group input:focus,
.client-input-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.button-group {
    display: flex;
    flex-direction: row;
    gap: 10px;
    margin-top: 8px;
}

.download-btn,
.share-btn,
.copy-btn {
    flex: 1;
    padding: 14px 24px;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.download-btn {
    background: #22c55e;
}

.download-btn:hover {
    background: #16a34a;
}

.share-btn {
    background: #667eea;
}

.share-btn:hover {
    background: #5a6fd6;
}

.copy-btn {
    background: #f59e0b;
}

.copy-btn:hover {
    background: #d97706;
}

.download-btn svg,
.share-btn svg,
.copy-btn svg {
    width: 18px;
    height: 18px;
    fill: white;
}

@media (max-width: 480px) {
    .client-container {
        padding: 16px;
        border-radius: 8px;
    }

    .client-input-group input {
        padding: 10px 12px;
        font-size: 14px;
    }

    .button-group {
        flex-direction: column;
    }

    .download-btn,
    .share-btn,
    .copy-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
}
