/* ======================================== */
/* ====== RESET & BASE STYLES ====== */
/* ======================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
    font-size: 16px;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 15px;
}

/* ======================================== */
/* ====== HEADER ====== */
/* ======================================== */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    margin-bottom: 20px;
}

.header h1 {
    font-size: 28px;
    margin: 0;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* ======================================== */
/* ====== TOPBAR ====== */
/* ======================================== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    padding: 10px 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
    flex-wrap: wrap;
    gap: 10px;
}

/* ======================================== */
/* ====== BREADCRUMB ====== */
/* ======================================== */
.breadcrumb {
    background: white;
    padding: 12px 20px;
    border-radius: 8px;
    margin: 15px 0 20px 0;
    font-size: 0.95em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.breadcrumb a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* ======================================== */
/* ====== ALERTS ====== */
/* ======================================== */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
    border-left: 4px solid transparent;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left-color: #28a745;
}

.alert-error,
.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-left-color: #dc3545;
}

.alert-danger {
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 15px;
}

/* ======================================== */
/* ====== BUTTONS ====== */
/* ======================================== */
button,
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    background: #667eea;
    color: white;
}

button:hover,
.btn:hover {
    background: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(118, 75, 162, 0.3);
}

button:active,
.btn:active {
    transform: scale(0.97);
}

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

.btn-logout {
    display: inline-block;
    padding: 8px 16px;
    background: #dc3545;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.3s;
}

.btn-logout:hover {
    background: #c82333;
    transform: none;
    box-shadow: none;
}

/* ======================================== */
/* ====== FILTER BUTTONS ====== */
/* ======================================== */
.filter-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-btn {
    padding: 10px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
}

.filter-btn.active,
.filter-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* ======================================== */
/* ====== TABLES ====== */
/* ======================================== */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 15px 0;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 14px;
    margin: 20px 0;
}

.table th,
.table td {
    padding: 10px;
    border: 1px solid #ddd;
    text-align: left;
}

.table-striped tbody tr:nth-child(odd) {
    background-color: #f9f9f9;
}

.table-hover tbody tr:hover {
    background-color: #f1f1f1;
}

/* ====== Legacy Table Support ====== */
table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    background: white;
    font-size: 14px;
}

table th,
table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e8e8e8;
}

table th {
    background: #667eea;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.5px;
}

table tr:hover {
    background: #f8f9ff;
}

table tr:last-child td {
    border-bottom: none;
}

/* ======================================== */
/* ====== FORMS ====== */
/* ======================================== */
.form-container {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    margin-top: 25px;
}

.form-container h2 {
    margin-bottom: 25px;
    font-size: 22px;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
    background: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input[readonly] {
    background: #f5f5f5;
}

.form-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

/* ======================================== */
/* ====== CARDS & PANELS ====== */
/* ======================================== */
.card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.panel-title {
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 18px;
}

.panel-text {
    color: #666;
    margin-bottom: 15px;
}

/* ======================================== */
/* ====== KUOTA & DIGITAL GRIDS ====== */
/* ======================================== */
.kuota-grid,
.digital-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 25px;
    margin-bottom: 25px;
}

.kuota-card,
.digital-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border-left: 5px solid #667eea;
    transition: all 0.3s;
}

.digital-card {
    border-left: none;
    border-top: 5px solid #667eea;
    text-align: center;
}

.kuota-card:hover,
.digital-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.kuota-card:active {
    transform: scale(0.98);
}

.kuota-title,
.digital-title {
    font-weight: 600;
    font-size: 18px;
    margin-bottom: 12px;
    color: #333;
}

.digital-title {
    font-size: 16px;
    margin-bottom: 10px;
}

.kuota-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.kuota-price,
.digital-price {
    font-size: 24px;
    color: #667eea;
    font-weight: 700;
}

.digital-price {
    margin-bottom: 15px;
}

.kuota-durasi {
    background: #f0f0f0;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    color: #666;
}

.digital-icon {
    font-size: 2.5em;
    margin-bottom: 15px;
}

.kuota-btn,
.digital-btn {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.3s;
    font-weight: 600;
    font-size: 14px;
}

.kuota-btn:hover,
.digital-btn:hover {
    background: #764ba2;
}

.kuota-btn:active,
.digital-btn:active {
    transform: scale(0.95);
}

/* ======================================== */
/* ====== LOGIN ====== */
/* ======================================== */
.login-body {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

.login-card {
    max-width: 400px;
    margin: 100px auto;
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.login-title {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

.login-form .form-group {
    margin-bottom: 15px;
}

.login-form label {
    display: block;
    margin-bottom: 5px;
    color: #555;
}

/* ======================================== */
/* ====== FOOTER ====== */
/* ======================================== */
.footer {
    margin-top: 40px;
    padding: 20px 0;
    text-align: center;
    color: #888;
    font-size: 0.9em;
    border-top: 1px solid #e0e0e0;
}

/* ======================================== */
/* ====== UTILITY CLASSES ====== */
/* ======================================== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.mb-30 {
    margin-bottom: 30px;
}

.profit {
    color: green;
    font-weight: bold;
}

.modal {
    color: #c00;
}

/* ======================================== */
/* ====== LOADING ANIMATION ====== */
/* ======================================== */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* ======================================== */
/* ====== SCROLLBAR STYLING ====== */
/* ======================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* ======================================== */
/* ====== RESPONSIVE DESIGN ====== */
/* ======================================== */

/* ====== Mobile First - Smartphone Portrait ====== */
@media (max-width: 480px) {
    /* Base */
    body {
        font-size: 15px;
    }
    
    .container {
        padding: 10px;
    }
    
    /* Header */
    .header {
        padding: 20px 15px;
        border-radius: 10px;
    }
    
    .header h1 {
        font-size: 22px;
    }
    
    /* Topbar */
    .topbar {
        flex-direction: column;
        text-align: center;
        padding: 10px 15px;
    }
    
    /* Breadcrumb */
    .breadcrumb {
        padding: 10px 15px;
        font-size: 13px;
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 8px;
    }
    
    /* Alerts */
    .alert {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    /* Tables - Convert to Cards */
    .table-wrapper {
        overflow-x: visible;
        margin: 10px 0;
    }
    
    .table,
    table {
        min-width: auto;
        font-size: 14px;
    }
    
    .table thead,
    table thead {
        display: none;
    }
    
    .table tbody,
    .table tr,
    .table td,
    table tbody,
    table tr,
    table td {
        display: block;
        width: 100%;
    }
    
    .table tr,
    table tr {
        margin-bottom: 15px;
        background: white;
        border-radius: 10px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.08);
        padding: 15px;
        border: none;
    }
    
    .table td,
    table td {
        border: none;
        padding: 8px 0;
        text-align: left;
        font-size: 14px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .table td:last-child,
    table td:last-child {
        border-bottom: none;
    }
    
    .table td::before,
    table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #667eea;
        flex: 0 0 40%;
        font-size: 13px;
    }
    
    .table td:last-child,
    table td:last-child {
        justify-content: flex-start;
        gap: 10px;
    }
    
    .table td:last-child::before,
    table td:last-child::before {
        flex: 0 0 40%;
    }
    
    /* Forms */
    .form-container {
        padding: 20px 15px;
        margin: 15px 0;
        border-radius: 10px;
    }
    
    .form-container h2 {
        font-size: 20px;
        text-align: center;
        margin-bottom: 20px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group label {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    .form-group input,
    .form-group select {
        padding: 12px 14px;
        font-size: 16px; /* Prevent zoom on iOS */
        border-radius: 8px;
    }
    
    /* Buttons */
    button,
    .btn {
        width: 100%;
        padding: 14px;
        font-size: 15px;
        margin-top: 8px;
        border-radius: 8px;
    }
    
    .btn-logout {
        width: 100%;
        text-align: center;
    }
    
    /* Grids */
    .kuota-grid,
    .digital-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-top: 15px;
    }
    
    .kuota-card,
    .digital-card {
        padding: 20px;
    }
    
    .kuota-title,
    .digital-title {
        font-size: 16px;
    }
    
    .kuota-price,
    .digital-price {
        font-size: 20px;
    }
    
    /* Filter buttons */
    .filter-buttons {
        gap: 8px;
        justify-content: center;
    }
    
    .filter-btn {
        padding: 10px 16px;
        font-size: 13px;
        flex: 1 1 auto;
        text-align: center;
        min-width: 60px;
    }
    
    /* Cards */
    .card {
        padding: 15px;
    }
    
    /* Login */
    .login-card {
        margin: 50px auto;
        padding: 20px;
    }
    
    /* Footer */
    .footer {
        font-size: 13px;
        padding: 15px 0;
        margin-top: 25px;
    }
}

/* ====== Tablet Portrait ====== */
@media (min-width: 481px) and (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    .kuota-grid,
    .digital-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .header h1 {
        font-size: 26px;
    }
    
    .form-container {
        padding: 25px;
    }
    
    .table,
    table {
        min-width: auto;
        font-size: 13px;
    }
    
    .table th,
    .table td,
    table th,
    table td {
        padding: 10px 12px;
    }
    
    .table td::before,
    table td::before {
        flex: 0 0 35%;
    }
}

/* ====== Desktop ====== */
@media (min-width: 769px) {
    .container {
        padding: 20px 30px;
    }
    
    .kuota-grid,
    .digital-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }
    
    .filter-buttons {
        justify-content: flex-start;
    }
    
    .form-container {
        padding: 30px;
    }
    
    .form-group input,
    .form-group select {
        max-width: 500px;
    }
    
    button,
    .btn {
        width: auto;
        padding: 12px 30px;
    }
    
    /* Restore table display for desktop */
    .table thead,
    table thead {
        display: table-header-group;
    }
    
    .table tbody tr,
    table tbody tr {
        display: table-row;
        box-shadow: none;
        padding: 0;
        border: none;
        margin: 0;
    }
    
    .table td,
    table td {
        display: table-cell;
        padding: 12px 15px;
        border-bottom: 1px solid #e8e8e8;
    }
    
    .table td::before,
    table td::before {
        display: none;
    }
}

/* Batasi lebar kolom Modal */
.table td.modal, 
.table th.modal {
  width: 120px;       /* atur sesuai kebutuhan */
  max-width: 120px;
  text-align: right;  /* angka rata kanan */
  white-space: nowrap; /* cegah teks turun ke bawah */
}
.table th.angka,
.table td.angka {
  width: 120px;        /* konsisten untuk semua kolom angka */
  max-width: 120px;
  text-align: right;
  white-space: nowrap;
}

.table td.modal {
  color: #c00;
}

.table td.profit {
  color: green;
  font-weight: bold;
}
