/* ===== TRANSPORTER MASTER STYLES ===== */

/* --- Mini Stat Cards --- */
.trm-mini-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.trm-mini-stat {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius);
    padding: 1.1rem 1.25rem;
    transition: all 0.3s ease;
}

.trm-mini-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.trm-mini-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.trm-mini-stat-icon svg {
    width: 22px;
    height: 22px;
}

.trm-mini-stat-icon.primary {
    background: var(--dash-primary-light);
    color: var(--dash-primary);
}

.trm-mini-stat-icon.success {
    background: var(--dash-success-light);
    color: var(--dash-success);
}

.trm-mini-stat-icon.warning {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.trm-mini-stat-icon.info {
    background: var(--dash-cyan-light);
    color: var(--dash-cyan);
}

.trm-mini-stat-content {
    display: flex;
    flex-direction: column;
}

.trm-mini-stat-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--dash-text-primary);
    line-height: 1.2;
}

.trm-mini-stat-label {
    font-size: 0.72rem;
    color: var(--dash-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* --- Toolbar --- */
.trm-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.trm-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.trm-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.trm-search-wrapper {
    position: relative;
}

.trm-search-wrapper svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--dash-text-muted);
}

.trm-search-wrapper input {
    padding: 0.6rem 0.85rem 0.6rem 2.4rem;
    border: 1px solid var(--dash-border);
    border-radius: 10px;
    background: var(--dash-surface);
    color: var(--dash-text-primary);
    font-size: 0.82rem;
    min-width: 260px;
    transition: all 0.3s ease;
}

.trm-search-wrapper input:focus {
    outline: none;
    border-color: var(--dash-primary);
    box-shadow: 0 0 0 3px var(--dash-primary-light);
}

.trm-filter-select {
    padding: 0.6rem 2rem 0.6rem 0.85rem;
    border: 1px solid var(--dash-border);
    border-radius: 10px;
    background: var(--dash-surface);
    color: var(--dash-text-primary);
    font-size: 0.82rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px;
    transition: all 0.3s ease;
}

.trm-filter-select:focus {
    outline: none;
    border-color: var(--dash-primary);
    box-shadow: 0 0 0 3px var(--dash-primary-light);
}

.trm-refresh-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--dash-border);
    background: var(--dash-surface);
    color: var(--dash-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.trm-refresh-btn svg {
    width: 18px;
    height: 18px;
}

.trm-refresh-btn:hover {
    background: var(--dash-primary);
    color: #fff;
    border-color: var(--dash-primary);
}

.trm-refresh-btn.spinning svg {
    animation: trm-spin 0.8s linear infinite;
}

@keyframes trm-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.trm-add-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--dash-primary), var(--dash-primary-hover));
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.trm-add-btn svg {
    width: 16px;
    height: 16px;
}

.trm-add-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

/* --- Table --- */
.trm-panel {
    position: relative;
    overflow: hidden;
}

.trm-sort-header {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.trm-sort-header::after {
    content: '↕';
    margin-left: 4px;
    opacity: 0.3;
    font-size: 0.75rem;
}

.trm-sort-header.sort-asc::after {
    content: '↑';
    opacity: 0.8;
    color: var(--dash-primary);
}

.trm-sort-header.sort-desc::after {
    content: '↓';
    opacity: 0.8;
    color: var(--dash-primary);
}

.trm-row td {
    vertical-align: middle;
}

.trm-name-cell {
    display: flex;
    flex-direction: column;
}

.trm-name-main {
    font-weight: 600;
    color: var(--dash-text-primary);
    font-size: 0.85rem;
}

.trm-name-sub {
    font-size: 0.72rem;
    color: var(--dash-text-muted);
    margin-top: 1px;
}

.trm-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--dash-primary-light);
    color: var(--dash-primary);
}

.trm-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.28rem 0.72rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.trm-status-badge.active {
    background: var(--dash-success-light);
    color: var(--dash-success);
}

.trm-status-badge.inactive {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.trm-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.trm-gender-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.trm-gender-badge.male {
    background: var(--dash-primary-light);
    color: var(--dash-primary);
}

.trm-gender-badge.female {
    background: rgba(244, 114, 182, 0.12);
    color: #ec4899;
}

/* --- Action Buttons --- */
.trm-row-actions {
    display: flex;
    gap: 0.4rem;
}

.trm-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.32rem 0.65rem;
    border-radius: 7px;
    border: 1px solid transparent;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.trm-action-btn svg {
    width: 13px;
    height: 13px;
}

.trm-action-btn.edit {
    background: var(--dash-primary-light);
    color: var(--dash-primary);
    border-color: rgba(99, 102, 241, 0.2);
}

.trm-action-btn.edit:hover {
    background: var(--dash-primary);
    color: #fff;
}

/* --- Empty State --- */
.trm-empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
}

.trm-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--dash-primary-light);
    color: var(--dash-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.trm-empty-icon svg {
    width: 32px;
    height: 32px;
}

.trm-empty-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--dash-text-primary);
    margin-bottom: 0.3rem;
}

.trm-empty-desc {
    font-size: 0.82rem;
    color: var(--dash-text-muted);
}

/* --- Pagination --- */
.trm-pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--dash-border);
}

.trm-page-info {
    font-size: 0.78rem;
    color: var(--dash-text-muted);
    font-weight: 500;
}

.trm-pagination {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.trm-page-btn {
    min-width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--dash-border);
    background: var(--dash-surface);
    color: var(--dash-text-primary);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.trm-page-btn:hover:not(:disabled):not(.active) {
    background: var(--dash-primary-light);
    color: var(--dash-primary);
    border-color: var(--dash-primary);
}

.trm-page-btn.active {
    background: var(--dash-primary);
    color: #fff;
    border-color: var(--dash-primary);
}

.trm-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.trm-page-dots {
    font-size: 0.78rem;
    color: var(--dash-text-muted);
    padding: 0 2px;
}

/* --- Loading --- */
.trm-loading-overlay {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 10;
    background: rgba(var(--dash-card-bg-rgb, 15, 15, 25), 0.85);
    backdrop-filter: blur(4px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    border-radius: var(--dash-radius);
}

.trm-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--dash-border);
    border-top-color: var(--dash-primary);
    border-radius: 50%;
    animation: trm-spin 0.8s linear infinite;
}

.trm-loading-text {
    font-size: 0.82rem;
    color: var(--dash-text-muted);
    font-weight: 500;
}

/* ========== MODAL ========== */
.trm-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.trm-modal-overlay.active {
    display: flex;
    animation: trm-fadeIn 0.25s ease-out;
}

@keyframes trm-fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.trm-modal {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: 16px;
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.35);
    animation: trm-slideUp 0.3s ease-out;
}

@keyframes trm-slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.trm-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--dash-border);
}

.trm-modal-header-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.trm-modal-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--dash-primary-light);
    color: var(--dash-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.trm-modal-icon svg {
    width: 20px;
    height: 20px;
}

.trm-modal-title {
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--dash-text-primary);
    margin: 0;
}

.trm-modal-subtitle {
    font-size: 0.76rem;
    color: var(--dash-text-muted);
    margin: 2px 0 0;
}

.trm-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--dash-border);
    background: transparent;
    color: var(--dash-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.trm-modal-close svg {
    width: 18px;
    height: 18px;
}

.trm-modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.trm-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.trm-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--dash-border);
}

/* --- Form Elements --- */
.trm-form-section {
    margin-bottom: 1.5rem;
}

.trm-form-section:last-child {
    margin-bottom: 0;
}

.trm-form-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--dash-primary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--dash-border);
}

.trm-form-section-title svg {
    width: 16px;
    height: 16px;
}

.trm-form-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.trm-form-grid:last-child {
    margin-bottom: 0;
}

.trm-form-grid-1 {
    grid-template-columns: 1fr;
}

.trm-form-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.trm-form-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.trm-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.trm-form-group label {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--dash-text-primary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.trm-required {
    color: #ef4444;
}

.trm-form-group input,
.trm-form-group select {
    padding: 0.58rem 0.85rem;
    border: 1px solid var(--dash-border);
    border-radius: 8px;
    background: var(--dash-surface-2);
    color: var(--dash-text-primary);
    font-size: 0.82rem;
    transition: all 0.2s ease;
}

.trm-form-group input:focus,
.trm-form-group select:focus {
    outline: none;
    border-color: var(--dash-primary);
    box-shadow: 0 0 0 3px var(--dash-primary-light);
}

.trm-form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    padding-right: 2rem;
    cursor: pointer;
}

/* --- Buttons --- */
.trm-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.3rem;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.trm-btn svg {
    width: 16px;
    height: 16px;
}

.trm-btn-secondary {
    background: var(--dash-surface-2);
    color: var(--dash-text-muted);
    border: 1px solid var(--dash-border);
}

.trm-btn-secondary:hover {
    background: var(--dash-border);
    color: var(--dash-text-primary);
}

.trm-btn-primary {
    background: linear-gradient(135deg, var(--dash-primary), var(--dash-primary-hover));
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.trm-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.trm-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* --- Toast --- */
.trm-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: none;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1.3rem;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 600;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    animation: trm-toastIn 0.35s ease-out;
}

.trm-toast.show {
    display: flex;
}

.trm-toast.success {
    background: var(--dash-success);
    color: #fff;
}

.trm-toast.error {
    background: #ef4444;
    color: #fff;
}

.trm-toast.info {
    background: var(--dash-primary);
    color: #fff;
}

@keyframes trm-toastIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes trm-toastOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

/* ===== LIGHT MODE ===== */
[data-theme="light"] .trm-loading-overlay {
    background: rgba(255, 255, 255, 0.85);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .trm-mini-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .trm-form-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .trm-mini-stats {
        grid-template-columns: 1fr;
    }

    .trm-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .trm-toolbar-left,
    .trm-toolbar-right {
        flex-wrap: wrap;
    }

    .trm-search-wrapper input {
        min-width: 100%;
    }

    .trm-form-grid-2,
    .trm-form-grid-3 {
        grid-template-columns: 1fr;
    }

    .trm-modal {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 12px;
    }

    .trm-pagination-bar {
        flex-direction: column;
        gap: 0.75rem;
    }
}