/* Smart Invoice Manager - Modern Card-Based Design */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #f8fafc;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --border-radius: 12px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--gray-50);
}

/* ===== CARDS ===== */
.sim-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    transition: all 0.2s ease;
    overflow: hidden;
}

.sim-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.sim-card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.sim-card-body {
    padding: 1.5rem;
}

.sim-card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
}

/* ===== DASHBOARD ===== */
.sim-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.sim-dashboard h2 {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 2rem;
    text-align: center;
}

.sim-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    transition: all 0.2s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.stat-card .stat-value {
    font-size: 3rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card .stat-label {
    font-size: 1rem;
    color: var(--gray-600);
    font-weight: 500;
}

/* ===== DASHBOARD MENU ===== */
.sim-dashboard-menu {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    margin-bottom: 2rem;
    overflow: hidden;
}

.sim-dashboard-menu ul {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    margin: 0;
    padding: 0;
    list-style: none;
}

.sim-dashboard-menu li {
    border-right: 1px solid var(--gray-100);
}

.sim-dashboard-menu li:last-child {
    border-right: none;
}

.sim-tab-link {
    display: block;
    padding: 1.25rem 1.5rem;
    color: var(--gray-700);
    text-decoration: none !important;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
    text-align: center;
}

.sim-tab-link:hover {
    background: var(--gray-50);
    color: var(--primary-color);
}

.sim-tab-link.active {
    background: var(--primary-color);
    color: white;
}

.sim-tab-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: white;
    border-radius: 2px;
}

/* ===== DASHBOARD CONTENT ===== */
.sim-dashboard-content {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    padding: 2rem;
}

/* ===== TABLES ===== */
.sim-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.sim-table thead tr {
    background: linear-gradient(135deg, var(--gray-100), var(--gray-200));
}

.sim-table th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--gray-200);
}

.sim-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

.sim-table tbody tr {
    transition: all 0.2s ease;
}

.sim-table tbody tr:hover {
    background: var(--gray-50);
}

.sim-table tbody tr:last-child td {
    border-bottom: none;
}

/* ===== ACTION BUTTONS ===== */
.sim-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none !important;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ===== FORMS ===== */
.sim-form-section {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.sim-form-section h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-color);
}

.sim-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.sim-form-group {
    margin-bottom: 1.5rem;
}

.sim-form-group label {
    display: block;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.sim-form-control {
    width: 100%;
    max-width: 280px;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--gray-200);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    background: white;
    font-family: inherit;
    line-height: 1.4;
}

.sim-form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

.sim-form-control[type="color"] {
    height: 48px;
    cursor: pointer;
}

.sim-form-actions {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--gray-100);
    text-align: right;
}

.sim-form-actions .btn {
    min-width: 140px;
}

/* ===== ITEM ROWS ===== */
.sim-item-row {
    display: grid;
    grid-template-columns: 2.5fr 1fr 1fr 1fr auto;
    gap: 0.75rem;
    align-items: end;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: 6px;
    border: 1px solid var(--gray-100);
}

.sim-item-row .sim-form-group {
    margin-bottom: 0;
}

.sim-item-row .sim-form-group label {
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-600);
}

.sim-item-row .sim-form-control {
    max-width: none;
    margin-bottom: 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.sim-form-actions {
    justify-self: center;
}

/* ===== TOTALS ===== */
.sim-totals-section {
    margin: 2rem 0;
}

.sim-totals-card {
    background: linear-gradient(135deg, var(--gray-50), white);
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.sim-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    font-size: 1.125rem;
    font-weight: 500;
}

.sim-total-row span:first-child {
    color: var(--gray-600);
}

.sim-total-row span:last-child {
    font-weight: 700;
    color: var(--gray-900);
}

.sim-grand-total {
    border-top: 2px solid var(--gray-300);
    margin-top: 1rem;
    padding-top: 1.5rem;
    font-size: 1.5rem;
}

.sim-grand-total span:last-child {
    color: var(--primary-color);
    font-size: 1.75rem;
}

/* ===== WALLET ===== */
.sim-wallet-balance {
    text-align: center;
    margin-bottom: 2rem;
}

.balance-display {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

.balance-display h4 {
    margin: 0 0 1rem;
    font-size: 1.125rem;
    font-weight: 500;
    opacity: 0.9;
}

.balance-amount {
    font-size: 3rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ===== PACKAGES ===== */
.sim-packages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.sim-package-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 2px solid var(--gray-200);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sim-package-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.sim-package-card.current-package {
    border-color: var(--success-color);
    background: linear-gradient(135deg, #ecfdf5, white);
}

.sim-package-card .current-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--success-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.package-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.package-header h4 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 0.5rem;
}

.package-price {
    text-align: center;
    margin-bottom: 1.5rem;
}

.package-price strong {
    font-size: 2rem;
    color: var(--primary-color);
    font-weight: 700;
}

.package-features {
    margin-bottom: 2rem;
}

.feature-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.feature-item:last-child {
    border-bottom: none;
}

.feature-label {
    font-weight: 500;
    color: var(--gray-700);
}

.feature-value {
    font-weight: 600;
    color: var(--gray-900);
}

/* ===== BUY COINS ===== */
.sim-buy-coins-section {
    background: var(--gray-50);
    border-radius: var(--border-radius);
    padding: 2rem;
    border: 1px solid var(--gray-200);
}

.sim-buy-coins-section h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 1.5rem;
}

/* ===== TRANSACTION HISTORY ===== */
.sim-transaction-history {
    margin-top: 2rem;
}

.sim-transaction-history h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 1.5rem;
}

.transaction-amount.credit {
    color: var(--success-color);
    font-weight: 600;
}

.transaction-amount.debit {
    color: var(--danger-color);
    font-weight: 600;
}

/* ===== STATUS BADGES ===== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.status-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.status-danger {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.status-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.status-primary {
    background: #f0f9ff;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

/* ===== TABLE CONTAINER ===== */
.sim-table-container {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

/* ===== FORM HELP ===== */
.sim-form-help {
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* ===== HERO + LOGIN ===== */
.sim-hero {
    background: linear-gradient(135deg, rgba(99,102,241,0.9), rgba(79,70,229,0.9));
    color: white;
    padding: 2.25rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2.5rem;
    text-align: center;
}

.sim-hero h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.sim-hero p {
    font-size: 1.05rem;
    margin-bottom: 1.5rem;
    opacity: 0.92;
}

.sim-hero .sim-quick-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.sim-hero .btn {
    min-width: 170px;
    font-size: 0.95rem;
    padding: 0.65rem 1.1rem;
}

.sim-login-form {
    max-width: 420px;
    margin: 0 auto;
    padding: 1.75rem;
    background: white;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.sim-login-form h3 {
    margin-top: 0;
    margin-bottom: 1.25rem;
    font-size: 1.5rem;
    color: var(--gray-900);
}

.sim-login-form input[type="text"],
.sim-login-form input[type="password"] {
    max-width: 100%;
}

.sim-login-form input[type="submit"] {
    width: 100%;
    margin-top: 1rem;
}

    margin-top: 0.25rem;
    font-style: italic;
}

/* ===== LOGO PREVIEW ===== */
.sim-logo-preview {
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 8px;
    border: 1px solid var(--gray-200);
}

/* ===== ALERTS ===== */
.sim-alert {
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    border: 1px solid;
    font-weight: 500;
}

.sim-alert-success {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}

.sim-alert-warning {
    background: #fffbeb;
    color: #92400e;
    border-color: #fde68a;
}

.sim-alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

/* ===== MODALS ===== */
.sim-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.sim-modal-content {
    background: white;
    margin: 5% auto;
    padding: 0;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 800px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.sim-modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--gray-100);
    background: var(--gray-50);
}

.sim-modal-body {
    padding: 2rem;
    max-height: 70vh;
    overflow-y: auto;
}

.sim-modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
    text-align: right;
}

.close-modal {
    color: var(--gray-400);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: var(--gray-600);
}

/* ===== SEARCH BOX ===== */
.sim-search-box {
    margin-bottom: 2rem;
}

.sim-search-input {
    width: 100%;
    padding: 1rem 1.5rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.sim-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

/* ===== EMPTY STATE ===== */
.sim-empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray-500);
}

.sim-empty-state h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 1rem;
}

.sim-empty-state p {
    font-size: 1.125rem;
    margin-bottom: 2rem;
}

/* ===== LOADING ===== */
.sim-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-600);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-200);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sim-dashboard {
        padding: 1rem;
    }

    .sim-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .sim-dashboard-menu ul {
        grid-template-columns: 1fr;
    }

    .sim-dashboard-menu li {
        border-right: none;
        border-bottom: 1px solid var(--gray-100);
    }

    .sim-actions {
        flex-direction: column;
    }

    .btn {
        justify-content: center;
    }

    .sim-table {
        font-size: 0.875rem;
    }

    .sim-table th,
    .sim-table td {
        padding: 0.75rem 1rem;
    }
}

/* ===== ANIMATIONS ===== */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}