/* ==========================================================================
   Base Styles
   ========================================================================== */
body { 
    font-family: Arial, sans-serif; 
    margin: 0; 
    line-height: 1.6; 
    background: linear-gradient(180deg, #000000 0%, #7b0000 100%);
    background-attachment: fixed;
    color: #ffffff;
    min-height: 100vh;
}

h1 { color: #ffffff; margin-bottom: 20px; text-align: center; }

a { color: #3498db; text-decoration: none; }
a:hover { text-decoration: underline; }

.btn { 
    display: inline-block; 
    padding: 10px 18px; 
    border-radius: 6px; 
    color: white !important; 
    border: none; 
    cursor: pointer; 
    font-size: 14px; 
    text-decoration: none; 
    transition: opacity 0.2s; 
    font-weight: 500; 
    box-sizing: border-box;
}
.btn:hover { opacity: 0.85; text-decoration: none; }
.btn-primary { background: #3498db; }
.btn-success { background: #27ae60; }
.btn-secondary { background: #95a5a6; }
.btn-danger { background: #e74c3c; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.text-center { text-align: center; }
.mt-60 { margin-top: 60px; }
.text-muted-light { color: #dddddd; }

/* Badge Status */
.badge { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: bold; display: inline-block; }
.badge-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.badge-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* Header Layout */
.header-flex { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 25px; 
    flex-wrap: wrap; 
    gap: 15px; 
}

/* Responsive Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-grid label {
    margin-top: 0;
}

.form-grid-full {
    grid-column: span 2;
}

/* ==========================================================================
   Global & DRY Styles (Modal, etc.)
   ========================================================================== */
.db-modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.db-modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border-radius: 8px;
    width: 80%;
    max-width: 500px;
    color: #333; /* Memastikan teks di dalam modal berwarna gelap */
}

.modal-footer {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

/* Modal Delete Layout Styles */
.modal-delete-content {
    max-width: 400px !important;
    text-align: center;
    padding: 35px 30px;
}

.modal-delete-content i {
    font-size: 55px;
    color: #e74c3c;
    display: block;
    margin-bottom: 15px;
}

.modal-delete-content h2 { margin-bottom: 10px; color: #2c3e50; }
.modal-delete-content p { color: #7f8c8d; margin-bottom: 30px; line-height: 1.5; }
.modal-delete-content .modal-footer { justify-content: center; }

/* Filter Styles */
.filter-card {
    background: #fff;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.filter-form {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
    background: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    max-width: 100% !important;
}

.filter-group { flex: 1; min-width: 120px; }
.filter-group label { margin-top: 0 !important; margin-bottom: 5px; font-size: 13px; color: #7f8c8d; font-weight: bold; }
.filter-group select, .filter-group input { margin-top: 0; padding: 10px; border: 1px solid #ddd; border-radius: 6px; }
.filter-actions { display: flex; gap: 8px; flex: 1.2; min-width: 180px; }
.filter-actions .btn { 
    flex: 1; 
    width: 0; /* Memaksa flexbox membagi ruang secara matematis sama rata */
    text-align: center; 
    white-space: nowrap; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    height: 38px; /* Menyamakan tinggi tombol dengan input filter */
}

/* Chart Card Styles */
.chart-card {
    background: #fff;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    color: #333;
    margin-bottom: 40px;
    transition: transform 0.3s ease;
}
.chart-card:hover { transform: translateY(-5px); }

/* ==========================================================================
   Form Styles
   ========================================================================== */
form { 
    max-width: 560px; 
    background: #fff; 
    padding: 25px; 
    border-radius: 8px; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    color: #333; /* Memastikan teks di dalam form berwarna gelap */
}
label { display: block; margin-top: 15px; font-weight: bold; color: #333; }
input, select, textarea { width: 100%; padding: 10px; margin-top: 6px; border: 1px solid #ddd; border-radius: 4px; box-sizing: border-box; color: #333; }
button[type="submit"] { width: 100%; margin-top: 20px; font-weight: bold; }
.error { color: #c0392b; background: #f9d6d2; padding: 12px; border-radius: 4px; margin-bottom: 20px; }

/* ==========================================================================
   Login Context Styles
   ========================================================================== */
.login-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.login-input {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    display: block;
}

/* ==========================================================================
   Dashboard Context & Responsive Tables
   ========================================================================== */
.db-table-container {
    width: 100%;
    overflow: hidden;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-top: 20px;
}

.db-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 0;
}

.db-table th, .db-table td { 
    padding: 18px 20px; 
    text-align: left; 
    color: #444;
    border-bottom: 1px solid #f0f0f0;
}

.db-table th { 
    background: #f8f9fa; 
    color: #2c3e50; 
    font-weight: 700;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #dee2e6;
}

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

.actions .btn { margin-right: 5px; margin-bottom: 5px; }

@media screen and (max-width: 768px) {
    .db-modal-content {
        width: 92%;
        margin: 40px auto;
        padding: 25px 20px;
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    }

    .modal-delete-content {
        padding: 30px 20px !important;
    }

    .modal-delete-content i {
        font-size: 45px !important;
        margin-bottom: 10px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-grid-full {
        grid-column: span 1;
    }

    .header-flex {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .menu-container { gap: 15px; padding: 10px; }
    .card-menu, .motor-card {
        width: 100%;
        max-width: 100%;
    }

    .db-table-container {
        background: transparent;
        box-shadow: none;
        overflow: visible;
        margin-top: 10px;
    }

    /* Transform Table to Card */
    .db-table thead {
        display: none; /* Sembunyikan header tabel di mobile */
    }

    .db-table, .db-table tbody, .db-table tr, .db-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .db-table tr {
        margin-bottom: 25px;
        border: 1px solid #dee2e6;
        border-radius: 10px;
        box-shadow: 0 8px 20px rgba(0,0,0,0.15);
        padding: 10px 5px;
        background: #fff;
        overflow: hidden;
    }

    .db-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        padding: 12px 15px;
        border-bottom: 1px solid #eee;
        gap: 15px;
        word-break: break-word;
        color: #2c3e50;
        font-size: 14px;
    }

    .db-table td:last-child {
        border-bottom: none;
        display: block;
        align-items: stretch;
        text-align: center;
        padding-top: 15px;
        background: #fcfcfc;
    }

    /* Menampilkan label kolom menggunakan data-label */
    .db-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #7f8c8d;
        text-align: left;
        flex-shrink: 0;
        width: 40%;
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .actions {
        display: flex;
        flex-direction: row;
        gap: 8px;
        padding: 5px;
    }

    .actions .btn {
        margin: 0;
        flex: 1;
        text-align: center;
        padding: 12px;
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    .modal-footer .btn {
        flex: 1;
        margin: 0;
    }
}

/* ==========================================================================
   Menu Cards (Dashboard)
   ========================================================================== */
.menu-container {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-top: 50px;
    flex-wrap: wrap;
    padding: 20px;
}

.card-menu {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    padding: 40px 20px;
    width: 260px;
    text-align: center;
    text-decoration: none !important;
    color: #2c3e50 !important;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.card-menu:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    border-color: #3498db;
}

.menu-icon {
    font-size: 50px;
    color: #3498db;
    display: block;
    margin-bottom: 20px;
}

.card-menu h2 { margin-bottom: 10px; color: #3498db; }
.card-menu p { font-size: 15px; color: #7f8c8d; line-height: 1.6; margin: 0; }

/* Motor Info Display Card */
.motor-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    padding: 30px 20px;
    width: 260px;
    text-align: center;
    color: #2c3e50;
    transition: all 0.3s ease;
}
.motor-card:hover { transform: translateY(-10px); box-shadow: 0 15px 35px rgba(0,0,0,0.1); }
.motor-card img { width: 100%; height: auto; border-radius: 8px; margin-bottom: 15px; }
.motor-card h2 { margin-bottom: 5px; color: #3498db; font-size: 20px; }
.motor-card p { font-size: 14px; color: #7f8c8d; margin: 0; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; }

/* Footer Utility Classes */
.pt-4 { padding-top: 1.5rem !important; }
.border-top { border-top: 1px solid rgba(255, 255, 255, 0.2) !important; }
.text-decoration-none { text-decoration: none !important; }

/* Scroll to Top Button */
#scrollToTopBtn {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99;
    border: none;
    outline: none;
    background-color: #3498db;
    color: white;
    cursor: pointer;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    transition: all 0.3s ease;
    font-size: 24px;
}
#scrollToTopBtn:hover { background-color: #2980b9; transform: scale(1.1); }