/**
 * Tutor Installments - Unified CSS
 * Single source of truth for all installment card styling
 *
 * @since 2.0.0
 */

:root {
    --tic-primary: #4f46e5;
    --tic-primary-dark: #4338ca;
    --tic-primary-light: #818cf8;
    --tic-success: #16a34a;
    --tic-warning: #f59e0b;
    --tic-danger: #ef4444;
    --tic-info: #0ea5e9;

    --tic-gray-50: #f9fafb;
    --tic-gray-100: #f3f4f6;
    --tic-gray-200: #e5e7eb;
    --tic-gray-300: #d1d5db;
    --tic-gray-500: #6b7280;
    --tic-gray-700: #374151;
    --tic-gray-900: #111827;

    --tic-radius: 8px;
    --tic-spacing: 16px;
    --tic-transition: all 0.3s ease;
    --tic-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --tic-box-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.tic-installment-box, 
.tic-installment-box *,
.tic-installment-box *::before,
.tic-installment-box *::after {
    box-sizing: border-box;
}

/* ────────────────────────────────────────
   Main Container
   ──────────────────────────────────────── */

.tic-installment-box {
    background: #ffffff;
    border: 1px solid var(--tic-gray-200);
    border-radius: var(--tic-radius);
    padding: var(--tic-spacing);
    margin-bottom: var(--tic-spacing);
    box-shadow: var(--tic-box-shadow);
    transition: var(--tic-transition);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    position: relative;
}

.tic-installment-box:hover {
    box-shadow: var(--tic-box-shadow-lg);
}

/* ────────────────────────────────────────
   Header Section
   ──────────────────────────────────────── */

.tic-box-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--tic-gray-100);
}

.tic-icon-wrap {
    width: 40px;
    height: 40px;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tic-primary) 0%, var(--tic-primary-dark) 100%);
    color: white;
    font-size: 20px;
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.2);
}

.tic-icon-wrap.tic-icon-locked {
    background: linear-gradient(135deg, var(--tic-danger) 0%, #dc2626 100%);
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.2);
}

.tic-icon-wrap.tic-icon-success {
    background: linear-gradient(135deg, var(--tic-success) 0%, #15803d 100%);
    box-shadow: 0 4px 6px rgba(22, 163, 74, 0.2);
}

.tic-header-content {
    flex: 1;
}

.tic-header-content h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--tic-gray-900);
}

.tic-premium-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--tic-primary);
    text-transform: uppercase;
    margin-top: 4px;
}

/* ────────────────────────────────────────
   Status Alerts
   ──────────────────────────────────────── */

.tic-status-area {
    margin-bottom: 16px;
}

.tic-alert {
    padding: 12px 16px;
    border-radius: var(--tic-radius);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

.tic-alert .dashicons {
    flex-shrink: 0;
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.tic-alert-success {
    background: #dcfce7;
    color: var(--tic-success);
    border-left: 4px solid var(--tic-success);
}

.tic-alert-warning {
    background: #fef3c7;
    color: #b45309;
    border-left: 4px solid var(--tic-warning);
}

.tic-alert-danger {
    background: #fee2e2;
    color: var(--tic-danger);
    border-left: 4px solid var(--tic-danger);
}

/* ────────────────────────────────────────
   Progress Bar
   ──────────────────────────────────────── */

.tic-progress-bar-wrap {
    width: 100%;
    height: 8px;
    background: var(--tic-gray-200);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}

.tic-progress-bar-fill {
    height: 100%;
    background: var(--tic-info);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 4px;
}

.tic-progress-bar-fill.active {
    background: linear-gradient(90deg, var(--tic-info) 0%, #0284c7 100%);
}

.tic-progress-bar-fill.overdue {
    background: linear-gradient(90deg, var(--tic-warning) 0%, #f59e0b 100%);
}

.tic-progress-bar-fill.suspended {
    background: linear-gradient(90deg, var(--tic-danger) 0%, #ef4444 100%);
}

/* ────────────────────────────────────────
   Pricing Summary
   ──────────────────────────────────────── */

.tic-pricing-summary {
    background: var(--tic-gray-50);
    border: 1px solid var(--tic-gray-200);
    border-radius: var(--tic-radius);
    padding: 12px;
    margin-bottom: 16px;
}

.tic-price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    padding: 8px 0;
    color: var(--tic-gray-700);
}

.tic-price-item:not(:last-child) {
    border-bottom: 1px solid var(--tic-gray-200);
    margin-bottom: 8px;
}

.tic-price-item.primary {
    font-weight: 600;
    color: var(--tic-primary);
    font-size: 16px;
}

.tic-price-item .tic-val {
    font-weight: 700;
    font-family: 'Monaco', 'Menlo', monospace;
}

/* ────────────────────────────────────────
   Buttons
   ──────────────────────────────────────── */

.tic-btn {
    display: inline-block;
    padding: 10px 16px;
    border: none;
    border-radius: var(--tic-radius);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--tic-transition);
    text-align: center;
    white-space: nowrap;
    user-select: none;
}

.tic-btn:focus {
    outline: 2px solid var(--tic-primary);
    outline-offset: 2px;
}

.tic-btn-large {
    padding: 12px 20px;
    font-size: 16px;
    width: 100%;
}

.tic-btn-primary {
    background: var(--tic-primary);
    color: white;
}

.tic-btn-primary:hover {
    background: var(--tic-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 12px rgba(79, 70, 229, 0.3);
}

.tic-btn-primary:active {
    transform: translateY(0);
}

.tic-btn-danger {
    background: var(--tic-danger);
    color: white;
}

.tic-btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 8px 12px rgba(239, 68, 68, 0.3);
}

.tic-btn-danger:active {
    transform: translateY(0);
}

.tic-btn-secondary {
    background: var(--tic-gray-200);
    color: var(--tic-gray-900);
}

.tic-btn-secondary:hover {
    background: var(--tic-gray-300);
}

/* ────────────────────────────────────────
   Footer/Action Area
   ──────────────────────────────────────── */

.tic-box-footer {
    display: flex;
    gap: 10px;
    flex-direction: column;
}

.tic-box-footer .tic-btn {
    margin: 0;
}

/* ────────────────────────────────────────
   Schedule Section
   ──────────────────────────────────────── */

.tic-mini-schedule {
    margin-top: 12px;
    border-top: 1px solid var(--tic-gray-200);
    padding-top: 12px;
}

.tic-toggle-schedule {
    width: 100%;
    background: var(--tic-gray-100);
    border: 1px solid var(--tic-gray-200);
    padding: 10px;
    border-radius: var(--tic-radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: var(--tic-gray-700);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--tic-transition);
}

.tic-toggle-schedule:hover {
    background: var(--tic-gray-200);
}

.tic-toggle-schedule .dashicons {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.tic-schedule-list {
    display: none;
    margin-top: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.tic-schedule-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid var(--tic-gray-200);
    font-size: 13px;
}

.tic-schedule-row:last-child {
    border-bottom: none;
}

.tic-schedule-info {
    flex: 1;
}

.tic-schedule-date {
    color: var(--tic-gray-500);
}

/* ────────────────────────────────────────
   State-Specific Styles
   ──────────────────────────────────────── */

.tic-state-available .tic-box-header {
    border-bottom-color: #dbeafe;
}

.tic-state-active .tic-box-header {
    border-bottom-color: #d1fae5;
}

.tic-state-overdue .tic-box-header {
    border-bottom-color: #fef3c7;
}

.tic-state-suspended .tic-box-header {
    border-bottom-color: #fee2e2;
}

.tic-state-completed .tic-box-header {
    border-bottom-color: #d1fae5;
}

/* ────────────────────────────────────────
   Responsive Design
   ──────────────────────────────────────── */

@media (max-width: 768px) {
    .tic-installment-box {
        padding: 12px;
    }

    .tic-box-header {
        gap: 10px;
        margin-bottom: 12px;
        padding-bottom: 10px;
    }

    .tic-icon-wrap {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .tic-header-content h3 {
        font-size: 14px;
    }

    .tic-premium-badge {
        font-size: 10px;
    }

    .tic-pricing-summary {
        padding: 10px;
    }

    .tic-price-item {
        font-size: 13px;
        padding: 6px 0;
    }

    .tic-price-item.primary {
        font-size: 14px;
    }

    .tic-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .tic-btn-large {
        padding: 10px 16px;
        font-size: 14px;
    }

    .tic-alert {
        padding: 10px 12px;
        font-size: 13px;
        gap: 10px;
    }

    .tic-alert .dashicons {
        font-size: 16px;
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 480px) {
    .tic-installment-box {
        padding: 10px;
        margin-bottom: 12px;
    }

    .tic-box-header {
        gap: 8px;
        margin-bottom: 10px;
    }

    .tic-icon-wrap {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .tic-header-content h3 {
        font-size: 13px;
    }

    .tic-pricing-summary {
        padding: 8px;
    }

    .tic-price-item {
        font-size: 12px;
        padding: 4px 0;
    }

    .tic-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* ────────────────────────────────────────
   Animations
   ──────────────────────────────────────── */

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tic-installment-box {
    animation: slideIn 0.3s ease-out;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.tic-loading {
    animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ────────────────────────────────────────
   Utility Classes
   ──────────────────────────────────────── */

.tic-hidden {
    display: none;
}

.tic-text-center {
    text-align: center;
}

.tic-mt-0 {
    margin-top: 0;
}

.tic-mb-0 {
    margin-bottom: 0;
}

/* ────────────────────────────────────────
   Print Styles
   ──────────────────────────────────────── */

@media print {
    .tic-installment-box {
        box-shadow: none;
        page-break-inside: avoid;
    }
}
