.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.5);
}

.modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.modal__content {
    background: white;
    border-radius: 12px;
    width: min(90vw, 1000px);
    max-width: calc(100vw - 32px);
    min-width: min(400px, 90vw);
    height: min(85vh, 800px);
    max-height: calc(100vh - 32px);
    min-height: 300px;
    position: absolute;
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15), 0 0 0 2px #3b82f6;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    resize: both;
    border: 1px solid #e5e7eb;
}

.modal__content::-webkit-resizer {
    background: linear-gradient(-45deg, transparent 0%, transparent 30%, #cbd5e1 30%, #cbd5e1 70%, transparent 70%, transparent 100%);
    border-radius: 0 0 12px 0;
}

.modal__header {
    padding: 24px;
    border-bottom: 2px solid #3b82f6;
    position: relative;
    flex-shrink: 0;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 12px 12px 0 0;
    color: white;
    cursor: grab;
    user-select: none;
}

.modal__header:active {
    cursor: grabbing;
}

.modal__title {
    margin: 0 0 8px 0;
    color: white;
    font-size: 24px;
    font-weight: 600;
}

.modal__subtitle {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
}

.modal__close-button {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 28px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.modal__close-button:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.modal__body {
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form__section {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.form__section-title {
    margin: 0 0 20px 0;
    color: #1f2937;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 2px solid #3b82f6;
    padding-bottom: 10px;
    position: relative;
}

.form__section-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: #1d4ed8;
}

.form__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.form__group {
    display: flex;
    flex-direction: column;
}

.form__group--full-width {
    grid-column: 1 / -1;
}

.form__label {
    margin-bottom: 6px;
    color: #4a5568;
    font-weight: 500;
    font-size: 14px;
}

.required {
    color: #e53e3e;
}

.form__input {
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form__input:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.form__select {
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
    appearance: none;
}

.form__select:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

/* Error States */
.form__input--error,
.form__select--error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
    background-color: #fef2f2;
}

.form__input--error:focus,
.form__select--error:focus {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15) !important;
}

.form__group--error .form__label {
    color: #dc2626;
    font-weight: 600;
}

.form__field-error {
    color: #dc2626;
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.form__field-error::before {
    content: '*';
    font-size: 12px;
    font-weight: bold;
    margin-right: 2px;
}

/* Success States */
.form__input--success,
.form__select--success {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form__group--success .form__label {
    color: #059669;
}

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

.form__checkbox-label input[type="checkbox"] {
    margin-right: 8px;
}

.form__info-message {
    background: #f7fafc;
    padding: 16px;
    border-radius: 8px;
    color: #4a5568;
    text-align: center;
}

.table__container {
    background: #f7fafc;
    border-radius: 8px;
    overflow-x: auto;
    width: 100%;
    box-sizing: border-box;
}

.table__container > .table {
    margin: 16px;
    width: calc(100% - 32px);
}

.table__container::-webkit-scrollbar {
    height: 8px;
}

.table__container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.table__container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.table__container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.table {
    width: 100%;
    table-layout: auto;
    border-radius: 4px;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid #ddd;
    min-width: max-content;
}



.table__cell {
    border: none;
    border-bottom: 1px solid #f1f5f9;
    padding: 16px 20px;
    font-size: 14px;
    background: #fff;
    vertical-align: middle;
    transition: background-color 0.15s ease;
}

.table__cell--first {
    text-align: left;
    font-weight: 500;
    color: #374151;
}

.table__cell--last {
    text-align: right;
    font-weight: 600;
    color: #059669;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 15px;
}

.table--package {
    width: 100%;
    table-layout: auto;
    border-radius: 4px;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid #ddd;
    min-width: max-content;
}

.table--package .table__header {
    color: #0b55c4;
    font-size: 13px;
    height: 26px;
    background-color: #f8f9fb;
    border-right: 1px solid #ddd;
    border-bottom: 2px solid #0b55c4;
    font-weight: bold;
    padding: 2px 8px;
    text-align: center;
    position: sticky;
    top: -1px;
}

.table--package .table__header:last-child {
    border-right: none;
}

.table--package .table__cell {
    height: 22px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 6px;
    border-right: 1px solid #ddd;
    font-size: 13px;
    text-align: center;
    color: #374151;
    cursor: pointer;
}

.table--package .table__cell:last-child {
    border-right: none;
}

.table--package tbody tr:nth-child(odd) {
    background: #e1ebfb;
}

.table--package tbody tr:nth-child(even) {
    background: #fff;
}

.table--package .table__cell:hover {
    overflow: visible;
}

.table--package tbody tr:hover .table__cell {
    white-space: normal;
    background: #c9f0ff !important;
    text-rendering: optimizeSpeed;
}

.table--rates {
    width: 100%;
    table-layout: auto;
    border-radius: 4px;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid #ddd;
    min-width: max-content;
}

.table--rates .table__header {
    color: #0b55c4;
    font-size: 13px;
    height: 26px;
    background-color: #f8f9fb;
    border-right: 1px solid #ddd;
    border-bottom: 2px solid #0b55c4;
    font-weight: bold;
    padding: 2px 8px;
    position: sticky;
    top: -1px;
}

.table--rates .table__header:first-child {
    text-align: left;
}

.table--rates .table__header:last-child {
    text-align: right;
    border-right: none;
    white-space: nowrap;
}

.table--rates .table__cell {
    height: 22px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 6px;
    border-right: 1px solid #ddd;
    font-size: 13px;
    cursor: pointer;
}

.table--rates .table__cell:last-child {
    border-right: none;
    white-space: nowrap;
    text-align: right;
}

.table--rates tbody tr:nth-child(odd) {
    background: #e1ebfb;
}

.table--rates tbody tr:nth-child(even) {
    background: #fff;
}

.table--rates .table__cell:hover {
    overflow: visible;
}

.table--rates tbody tr:hover .table__cell {
    white-space: normal;
    background: #c9f0ff !important;
    text-rendering: optimizeSpeed;
}

.rates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    width: 100%;
}

@media (max-width: 768px) {
    .rates-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

@media (max-width: 640px) {
    .modal__content {
        width: 95vw;
        min-width: 320px;
        height: 90vh;
        top: 2%;
        resize: none;
    }
    
    .modal__body {
        padding: 16px;
        gap: 15px;
    }
    
    .form__section {
        padding: 15px;
    }
}

.carrier-card {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.carrier-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e1;
}

.carrier-card__header {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 2px solid #e2e8f0;    
}

.carrier-card__logo {
    width: 60px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-weight: bold;
    font-size: 14px;
    color: white;
}

.carrier-card__logo--ups {
    background: #8B4513;
}

.carrier-card__logo--fedex {
    background: #4B0082;
}

.carrier-card__title {
    margin: 0;
    flex: 1;
    color: #2d3748;
    font-size: 16px;
    font-weight: 600;
}

.carrier-card__spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #3182ce;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.carrier-card__body {
    padding: 20px;
    overflow-x: auto;
}

.carrier-card__body::-webkit-scrollbar {
    height: 6px;
}

.carrier-card__body::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.carrier-card__body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.carrier-card__body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.carrier-card__placeholder {
    text-align: center;
    color: #718096;
    padding: 24px;
    font-style: italic;
}

.carrier-card__error-message {
    background: #fed7d7;
    color: #c53030;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
}

.modal__footer {
    padding: 20px 24px;
    border-top: 2px solid #f3f4f6;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 0 0 12px 12px;
    min-height: 84px;
    box-sizing: border-box;
}

.button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    position: relative;
    text-decoration: none;
    user-select: none;
    white-space: nowrap;
}

.button--secondary {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.button--secondary:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #94a3b8;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.button--secondary:active:not(:disabled) {
    background: #e2e8f0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    color: #475569;
}

.button--primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: 1px solid #2563eb;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.button--primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-color: #1d4ed8;
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.button--primary:active:not(:disabled) {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    box-shadow: inset 0 2px 4px rgba(59, 130, 246, 0.3);
    color: white;
}

.button:disabled {
    background: #e2e8f0 !important;
    color: #94a3b8 !important;
    border-color: #e2e8f0 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
    opacity: 0.6;
}

.button__spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}