/**
 * IMEIhub by Cici Gadget
 * Components CSS — Stepper, Stat Cards, Data Tables, Toast, Modal, Upload
 */

/* ===================================================
   STEPPER COMPONENT (4 Steps from Mockup)
   =================================================== */
.stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    margin: 1.5rem 0 2.5rem;
    padding: 0 1rem;
}

.stepper::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 40px;
    right: 40px;
    height: 3px;
    background: var(--color-neutral-200);
    z-index: 1;
}

.step-item {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
    cursor: default;
}

.step-circle {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    background: var(--color-neutral-0);
    border: 2px solid var(--color-neutral-300);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
}

.step-label {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: color var(--transition-base);
    white-space: nowrap;
}

.step-item.active .step-circle {
    background: var(--gradient-primary);
    border-color: transparent;
    color: #fff;
    box-shadow: var(--shadow-glow);
    transform: scale(1.1);
}

.step-item.active .step-label {
    color: var(--color-primary-700);
    font-weight: 700;
}

.step-item.completed .step-circle {
    background: var(--color-success-500);
    border-color: transparent;
    color: #fff;
}

.step-item.completed .step-label {
    color: var(--color-success-600);
}

/* ===================================================
   STAT CARDS (Dashboard & Reports)
   =================================================== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--color-neutral-0);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    border: 1px solid var(--color-primary-100);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary-200);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.stat-card:hover::after {
    opacity: 1;
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.stat-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    font-family: var(--font-heading);
}

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 0.2rem;
}

.stat-trend.up {
    color: var(--color-success-600);
}

.stat-trend.down {
    color: var(--color-danger-500);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    background: var(--color-primary-50);
    color: var(--color-primary-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

/* ===================================================
   DATA TABLES (Responsive & Clean)
   =================================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
    font-size: 0.9rem;
}

.table th {
    background-color: var(--color-primary-50);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.9rem 1.25rem;
    border-bottom: 1.5px solid var(--color-primary-200);
    white-space: nowrap;
}

.table td {
    padding: 1rem 1.25rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--color-neutral-100);
    background-color: var(--color-neutral-0);
    vertical-align: middle;
    transition: background-color var(--transition-fast);
}

.table tbody tr:hover td {
    background-color: var(--color-primary-50);
}

.table-action-btn {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* ===================================================
   FILE UPLOAD AREA (Drag & Drop)
   =================================================== */
.dropzone {
    border: 2px dashed var(--color-primary-200);
    background: var(--color-primary-50);
    border-radius: var(--radius-xl);
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--color-primary-500);
    background: var(--color-primary-100);
    box-shadow: var(--shadow-sm);
}

.dropzone-icon {
    font-size: 2.5rem;
    color: var(--color-primary-500);
    margin-bottom: 0.75rem;
}

.dropzone-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.dropzone-desc {
    font-size: 0.825rem;
    color: var(--text-secondary);
}

.dropzone input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.dropzone-preview {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: #fff;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-neutral-200);
}

.dropzone-preview img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

/* ===================================================
   TOAST NOTIFICATION (AJAX feedback)
   =================================================== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-xl);
    border-left: 4px solid var(--color-primary-500);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 320px;
    max-width: 440px;
    animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast--success { border-left-color: var(--color-success-500); }
.toast--danger { border-left-color: var(--color-danger-500); }
.toast--warning { border-left-color: var(--color-warning-500); }
.toast--info { border-left-color: var(--color-info-500); }

.toast-message {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.2rem;
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ===================================================
   MODAL
   =================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(38, 17, 32, 0.55);
    backdrop-filter: blur(4px);
    z-index: 1040;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-backdrop.show {
    display: flex;
}

.modal-card {
    background: #fff;
    border-radius: var(--radius-2xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-neutral-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--color-neutral-100);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

@keyframes modalPop {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ===================================================
   PACKAGE SELECTION CARDS (Customer Step 2)
   =================================================== */
.package-card {
    border: 2px solid var(--color-neutral-200);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    background: #fff;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.package-card:hover {
    border-color: var(--color-primary-300);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.package-card.selected {
    border-color: var(--color-primary-500);
    background: var(--color-primary-50);
    box-shadow: var(--shadow-glow);
}

.package-card.selected::before {
    content: '✓';
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 24px;
    height: 24px;
    background: var(--gradient-primary);
    color: #fff;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
}

.package-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.package-price {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--color-primary-600);
    margin-bottom: 1rem;
}

.package-features {
    list-style: none;
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.package-features li {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.package-features li::before {
    content: '•';
    color: var(--color-primary-500);
    font-size: 1.25rem;
    line-height: 0;
}
