@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* ==========================================================================
   Global & Login Styling
   ========================================================================== */
body {
    font-family: 'Poppins', sans-serif;
    background-color: #f8f9fa;
    color: #495057;
    line-height: 1.5;
    margin: 0;
    padding: 15px;
    font-size: 14px;
}

.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #007bff, #0056b3);
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-container h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
}

.login-logo {
    max-width: 220px;
    margin-bottom: 20px;
}

.login-container .form-group {
    text-align: left;
    margin-bottom: 20px;
}

.login-container .form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-sizing: border-box;
}

.login-container .btn-primary {
    width: 100%;
    padding: 12px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    justify-content: center; /* Menengahkan teks di dalam tombol */
    transition: background-color 0.3s;
}

.login-container .btn-primary:hover {
    background-color: #0056b3;
}

.login-hint {
    margin-top: 20px;
    font-size: 12px;
    color: #888;
}

.login-container .form-group.remember-me {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin-bottom: 20px;
    text-align: left;
}

.login-container .form-group.remember-me label {
    display: inline;
    margin-bottom: 0;
    font-weight: 400;
}

/* ==========================================================================
   Dashboard Styling
   ========================================================================== */
.dashboard-container {
    max-width: 1200px;
    margin: auto;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.07);
    margin-bottom: 25px;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.dashboard-logo {
    height: 50px;
    width: auto;
    display: block;
}

.dashboard-header h1 {
    margin: 0;
    font-size: 1.8em;
    color: #0056b3;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn-logout {
    background-color: #dc3545;
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    text-decoration: none;
    transition: background-color 0.3s;
}

.btn-logout:hover {
    background-color: #c82333;
    text-decoration: none;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    display: flex;
    align-items: center;
    background-color: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.07);
    gap: 20px;
}

.stat-icon {
    font-size: 2em;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.stat-info h4 {
    margin: 0 0 5px 0;
    color: #6c757d;
}

.stat-info p {
    margin: 0;
    font-size: 2em;
    font-weight: 600;
    color: #343a40;
}

.dashboard-main h2 {
    font-size: 1.5em;
    margin-bottom: 20px;
    color: #0056b3;
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.nav-card {
    background-color: #fff;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    text-decoration: none;
    color: #343a40;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.07);
    transition: transform 0.3s, box-shadow 0.3s;
}

.nav-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    text-decoration: none;
}

.nav-card i {
    font-size: 2.5em;
    color: #007bff;
    margin-bottom: 15px;
}

.nav-card h3 {
    margin: 0 0 10px 0;
    color: #0056b3;
}

.nav-card p {
    margin: 0;
    font-size: 0.9em;
    color: #6c757d;
}

.dashboard-footer {
    text-align: center;
    margin-top: 40px;
    color: #6c757d;
    font-size: 0.9em;
}

/* ==========================================================================
   Main App Styling (Warga, KK, Laporan)
   ========================================================================== */
.container {
    max-width: 1100px;
    margin: auto;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.07);
    border: 1px solid #e9ecef;
}

h1, h2, h3 {
    color: #0056b3;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-form {
    margin: 0;
    position: relative;
}

.filter-form::after {
    content: '\f078'; /* Font Awesome caret-down icon */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    pointer-events: none;
}

.search-wrapper {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
}

#filter,
#filterInput {
    box-sizing: border-box;
    width: 350px;
    border: 1px solid #ccc;
    border-radius: 20px;
    transition: all 0.3s ease;
    padding: 8px 15px;
}

#filter {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 35px !important;
}

#filterInput {
    padding-left: 35px;
}

#filter:focus,
#filterInput:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

th {
    background-color: #f8f9fa;
    color: #343a40;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

tbody tr:hover {
    background-color: #f1f3f5;
}

a {
    color: #007bff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    text-decoration: none;
}

.btn-add {
    background-color: #007bff;
    color: white;
}

.btn-back {
    background-color: #6c757d;
    color: white;
}

.action-icons {
    white-space: nowrap;
}

.btn-icon {
    display: inline-block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    border-radius: 50%;
    color: white;
    margin: 0 4px;
    transition: all 0.2s ease-in-out;
}

.btn-icon:hover {
    transform: scale(1.1);
    text-decoration: none;
}

.btn-edit {
    background-color: #ffc107;
}

.btn-delete {
    background-color: #dc3545;
}

.btn-submit {
    background-color: #28a745;
    color: white;
}

.alert {
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 15px;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 2px solid #0056b3;
    padding-bottom: 10px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.card-header {
    background-color: #f8f9fa;
    padding: 12px 20px;
    border-bottom: 1px solid #e9ecef;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.card-header h3 {
    margin: 0;
    font-size: 1em;
}

.card-body {
    padding: 20px;
    font-size: 1em;
}

.detail-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.detail-list li {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.detail-list li:last-child {
    border-bottom: none;
}

.detail-list li strong {
    flex-basis: 220px;
    flex-shrink: 0;
    color: #555;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.form-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

.form-actions .btn-submit {
    width: auto;
    font-size: 15px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media screen and (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    #filter, #filterInput {
        width: 100%;
    }

    table, thead, tbody, th, td, tr {
        display: block;
    }

    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    tr {
        border: 1px solid #dee2e6;
        border-radius: 8px;
        margin-bottom: 10px;
    }

    td {
        border: none;
        border-bottom: 1px solid #f1f3f5;
        position: relative;
        padding-left: 45%;
        text-align: right;
        min-height: auto;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    td:before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        width: calc(45% - 30px);
        white-space: nowrap;
        text-align: left;
        font-weight: 600;
        color: #343a40;
    }

    td[data-label="No."] {
        display: none;
    }

    .action-icons {
        text-align: right;
    }

    .detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .detail-list li {
        flex-wrap: wrap;
        align-items: baseline;
    }

    .detail-list li strong {
        flex-basis: auto;
        width: 100%;
        margin-bottom: 5px;
    }

    .form-actions {
        flex-direction: column;
        align-items: start;
    }

    /* Modifikasi untuk dashboard di mobile */
    .stats-grid,
    .nav-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .stat-card {
        padding: 15px;
    }
}