/**
 * PORTAKAT - Custom Styles v2
 * Portal Terpadu Aplikasi Kecamatan
 * Tema: Hijau PKB & Putih - List View
 */

:root {
    --primary-color: #006B3F;
    --primary-dark: #004D2C;
    --primary-light: #00A65A;
    --secondary-color: #28A745;
    --accent-color: #2ECC71;
    --white: #FFFFFF;
    --light-gray: #F8F9FA;
    --gray: #6C757D;
    --dark: #333333;
    --shadow: 0 2px 10px rgba(0, 107, 63, 0.08);
    --shadow-hover: 0 4px 20px rgba(0, 107, 63, 0.15);
    --transition: all 0.3s ease;
    --border-radius: 10px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--light-gray);
    color: var(--dark);
    min-height: 100vh;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 0.75rem 0;
    box-shadow: var(--shadow);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--white) !important;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-brand i {
    font-size: 1.8rem;
}

.navbar-brand div {
    line-height: 1.2;
}

.navbar-brand span {
    font-size: 0.7rem;
    font-weight: 400;
    display: block;
    opacity: 0.85;
}

/* Navbar Logo Professional Sizing */
.navbar-brand-logo {
    height: 50px;
    width: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.navbar-brand-logo:hover {
    transform: scale(1.05);
}

@media (max-width: 991px) {
    .navbar-brand-logo {
        height: 40px;
    }
}

/* Login Logo Professional Sizing */
.login-logo {
    height: 120px;
    width: auto;
    margin-bottom: 2rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

@media (max-width: 576px) {
    .login-logo {
        height: 100px;
        /* Smaller on mobile */
        margin-bottom: 1.5rem;
    }
}

/* Navbar Search (kecil) */
.navbar-search {
    max-width: 280px;
}

.navbar-search .form-control {
    border-radius: 20px 0 0 20px;
    border: none;
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
}

.navbar-search .btn {
    border-radius: 0 20px 20px 0;
    padding: 0.4rem 0.8rem;
}

/* Nav Links */
.nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem !important;
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--white) !important;
}

/* Kecamatan Dropdown */
.kecamatan-dropdown {
    max-height: 400px;
    overflow-y: auto;
}

.kecamatan-dropdown .dropdown-item {
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
}

.kecamatan-dropdown .dropdown-item.active {
    background-color: var(--primary-color);
}

/* Hero Section Compact */
.hero-section-compact {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--white);
    padding: 2.5rem 0 2rem 0;
}

.hero-section-compact h1 {
    font-weight: 700;
    font-size: 1.8rem;
    margin-bottom: 0.25rem;
}

.hero-section-compact p {
    font-size: 1rem;
    opacity: 0.9;
}

.stats-inline {
    font-size: 0.9rem;
    opacity: 0.95;
}

.stats-inline span {
    display: inline-block;
}

/* Category Section */
.category-section {
    margin-bottom: 2rem;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--white);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow);
}

.category-header i {
    font-size: 1.3rem;
    color: var(--primary-color);
}

.category-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
    flex: 1;
}

/* App List View - 4 Columns */
.app-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

@media (max-width: 1200px) {
    .app-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 991px) {
    .app-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .app-list {
        grid-template-columns: 1fr;
    }
}

.app-list-item {
    display: flex;
    align-items: center;
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
    text-decoration: none;
    color: var(--dark);
    transition: var(--transition);
    box-shadow: var(--shadow);
    border: 1px solid transparent;
}

.app-list-item:hover {
    border-color: var(--primary-color);
    transform: translateX(5px);
    box-shadow: var(--shadow-hover);
    color: var(--primary-color);
}

.app-list-item .app-icon {
    width: 60px;
    height: 60px;
    min-width: 60px;
    background: var(--light-gray);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Added subtle border */
}

.app-list-item .app-icon img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.app-list-item .app-icon i {
    font-size: 1.3rem;
    color: var(--primary-color);
}

.app-list-item .app-info {
    flex: 1;
}

.app-list-item .app-info h5 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 2px 0;
}

.app-list-item .app-info .app-url {
    font-size: 0.75rem;
    color: var(--gray);
}

.app-list-item .app-arrow {
    color: var(--gray);
    transition: var(--transition);
}

.app-list-item:hover .app-arrow {
    color: var(--primary-color);
    transform: translateX(5px);
}

/* Search Result Header */
.search-result-header {
    background: var(--white);
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

/* No Results */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--white);
    border-radius: var(--border-radius);
}

.no-results i {
    font-size: 3rem;
    color: var(--gray);
    margin-bottom: 1rem;
}

.no-results h4 {
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.no-results p {
    color: var(--gray);
}

/* Footer */
.footer {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: var(--white);
    padding: 2.5rem 0 1rem;
    margin-top: 2rem;
}

.footer h5 {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.footer p {
    opacity: 0.9;
    font-size: 0.85rem;
    line-height: 1.7;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 1rem;
    margin-top: 1.5rem;
    text-align: center;
    opacity: 0.8;
    font-size: 0.8rem;
}

/* Admin Styles */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    width: 260px;
    min-width: 260px;
    padding: 0;
}

.admin-sidebar .brand {
    padding: 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-sidebar .brand h4 {
    color: var(--white);
    font-weight: 700;
    font-size: 1.2rem;
    margin: 0;
}

.admin-sidebar .brand small {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
}

.admin-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8) !important;
    padding: 0.9rem 1.5rem !important;
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 3px solid transparent;
    font-size: 0.9rem;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white) !important;
    border-left-color: var(--accent-color);
}

.admin-sidebar .nav-link i {
    width: 20px;
    text-align: center;
}

.admin-content {
    flex: 1;
    padding: 1.5rem;
    background: var(--light-gray);
    overflow-x: auto;
}

.admin-header {
    background: var(--white);
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header h4 {
    font-size: 1.2rem;
    margin: 0;
}

.admin-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.admin-card h5 {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--light-gray);
}

/* Stat Cards */
.stat-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-card .stat-icon {
    width: 55px;
    height: 55px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card .stat-icon i {
    font-size: 1.4rem;
    color: var(--white);
}

.stat-card .stat-info h3 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.stat-card .stat-info p {
    margin: 0;
    color: var(--gray);
    font-size: 0.85rem;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
}

.login-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
}

.login-card h3 {
    color: var(--primary-color);
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.login-card .subtitle {
    text-align: center;
    color: var(--gray);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* Form Styles */
.form-control {
    border-radius: 8px;
    padding: 0.6rem 1rem;
    border: 2px solid #e9ecef;
    transition: var(--transition);
    font-size: 0.9rem;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 107, 63, 0.1);
}

.form-label {
    font-weight: 500;
    color: var(--dark);
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.form-select {
    border-radius: 8px;
    padding: 0.6rem 1rem;
    border: 2px solid #e9ecef;
    font-size: 0.9rem;
}

.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 107, 63, 0.1);
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    transform: translateY(-1px);
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* Table */
.table {
    font-size: 0.9rem;
}

.table thead th {
    background: var(--primary-color);
    color: var(--white);
    font-weight: 600;
    border: none;
    padding: 0.9rem 1rem;
    font-size: 0.85rem;
}

.table tbody td {
    padding: 0.9rem 1rem;
    vertical-align: middle;
}

.table tbody tr:hover {
    background: rgba(0, 107, 63, 0.03);
}

/* Alert */
.alert {
    border-radius: 8px;
    border: none;
    padding: 0.9rem 1rem;
    font-size: 0.9rem;
}

/* Badge */
.badge {
    padding: 0.4em 0.8em;
    border-radius: 15px;
    font-weight: 500;
    font-size: 0.75rem;
}

/* Icon Preview */
.icon-preview {
    width: 50px;
    height: 50px;
    background: var(--light-gray);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.5rem;
}

.icon-preview img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

/* Responsive */
@media (max-width: 991px) {
    .admin-sidebar {
        width: 100%;
        min-width: 100%;
    }

    .admin-wrapper {
        flex-direction: column;
    }

    .admin-sidebar .nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 0.5rem;
    }

    .admin-sidebar .brand {
        display: none;
    }

    .admin-sidebar .nav-link {
        padding: 0.75rem 1rem !important;
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
    }

    .admin-sidebar .nav-link.active,
    .admin-sidebar .nav-link:hover {
        border-left: none;
        border-bottom-color: var(--accent-color);
    }

    .navbar-search {
        order: 3;
        width: 100%;
        max-width: 100%;
        margin: 1rem 0 0 0;
    }
}

@media (max-width: 767px) {
    .hero-section-compact {
        padding: 1.5rem 0;
        text-align: center;
    }

    .hero-section-compact h1 {
        font-size: 1.5rem;
    }

    .stats-inline {
        margin-top: 1rem;
    }

    .app-list-item {
        padding: 0.9rem 1rem;
    }

    .app-list-item .app-icon {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }

    .app-list-item .app-info h5 {
        font-size: 0.9rem;
    }

    .category-header h2 {
        font-size: 1rem;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-section {
    animation: fadeIn 0.4s ease forwards;
}

.app-list-item {
    animation: fadeIn 0.3s ease forwards;
}

/* ========================================
   Google Search in Header
   ======================================== */
.google-search-form {
    max-width: 800px;
    width: 100%;
}

.google-search-form .input-group {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.google-search-form .input-group:hover,
.google-search-form .input-group:focus-within {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.google-search-icon {
    background: transparent !important;
    border: none !important;
    padding: 0.5rem 0.75rem 0.5rem 1rem;
}

.google-search-input {
    border: none !important;
    padding: 0.6rem 0 !important;
    font-size: 0.9rem !important;
    background: transparent !important;
}

.google-search-input:focus {
    box-shadow: none !important;
    outline: none !important;
}

.google-search-input::placeholder {
    color: #888;
}

.google-search-btn {
    background: transparent !important;
    border: none !important;
    color: var(--primary-color) !important;
    padding: 0.5rem 1rem !important;
    transition: var(--transition);
}

.google-search-btn:hover {
    color: var(--primary-dark) !important;
    transform: scale(1.1);
}

/* ========================================
   Application Search Section (Body)
   ======================================== */
/* Reduced padding for section */
.app-search-section {
    background: transparent;
    padding: 0.5rem 0;
    /* Reduced vertical padding */
    margin-bottom: 0;
}

/* Flat search box - no card style, full width, left aligned */
.app-search-box {
    max-width: 100%;
    /* Full width */
    margin: 0;
    /* Left align (remove margin auto) */
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

.app-search-title {
    display: none;
    /* Hide title as requested earlier, double check if needed */
}

/* Flanner input group */
.app-search-form .input-group {
    border-radius: 5px;
    /* Even smaller radius */
    overflow: hidden;
    box-shadow: none;
    border: 1px solid #ced4da;
    transition: var(--transition);
}

.app-search-form .input-group:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 107, 63, 0.1);
    /* Subtle focus ring */
}

.app-search-form .form-control {
    border: none !important;
    padding: 0.4rem 0.8rem !important;
    /* Smaller compact padding */
    font-size: 0.9rem;
    /* Smaller font */
    height: auto;
}

.app-search-form .form-control:focus {
    box-shadow: none !important;
}

.app-search-form .form-control::placeholder {
    color: #999;
}

.app-search-form .btn {
    border-radius: 0 !important;
    padding: 0.4rem 1rem;
    /* Compact button */
    margin: 0;
    /* Remove margin */
    font-size: 0.9rem;
}

/* ========================================
   Admin Search Box
   ======================================== */
.admin-search-box {
    width: 220px;
}

.admin-search-box .form-control {
    border-radius: 20px;
    padding: 0.4rem 1rem;
    border: 2px solid #e9ecef;
    font-size: 0.85rem;
    transition: var(--transition);
}

.admin-search-box .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 107, 63, 0.1);
}

/* ========================================
   Responsive Adjustments
   ======================================== */
@media (max-width: 991px) {
    .google-search-form {
        order: 3;
        width: 100%;
        max-width: 100%;
        margin: 1rem 0 0 0;
    }

    .app-search-box {
        padding: 1.25rem 1.5rem;
    }
}

@media (max-width: 767px) {
    .app-search-section {
        padding: 1.5rem 0;
    }

    .app-search-box {
        padding: 1rem 1.25rem;
        border-radius: 15px;
    }

    .app-search-title {
        font-size: 1rem;
    }

    .app-search-form .form-control {
        padding: 0.75rem 1rem !important;
        font-size: 0.9rem;
    }

    .app-search-form .btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .admin-search-box {
        width: 100%;
    }
}

/* ========================================
   Category Accordion Styles
   ======================================== */
.category-accordion {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.category-accordion .accordion-item {
    border: none;
    border-radius: 0 !important;
    overflow: hidden;
    box-shadow: none;
    margin: 0 !important;
    border-bottom: 1px solid #e9ecef;
}

.category-accordion .accordion-header {
    margin: 0;
}

.category-accordion .accordion-button {
    background: var(--white);
    border: none;
    border-left: 4px solid var(--primary-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    box-shadow: none;
}

.category-accordion .accordion-button:not(.collapsed) {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--white);
    border-left-color: var(--primary-dark);
}

.category-accordion .accordion-button:not(.collapsed) .badge {
    background: rgba(255, 255, 255, 0.3) !important;
}

.category-accordion .accordion-button::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23006B3F'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}

.category-accordion .accordion-button:not(.collapsed)::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}

.category-accordion .accordion-button:focus {
    box-shadow: none;
}

.category-accordion .accordion-button i {
    font-size: 1.2rem;
}

.category-accordion .category-name {
    flex: 1;
    text-align: left;
}

.category-accordion .accordion-body {
    padding: 1rem;
    background: var(--light-gray);
}

.category-accordion .accordion-collapse {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* ========================================
   Expand Toggle Switch
   ======================================== */
.expand-toggle {
    display: flex;
    justify-content: flex-start;
    /* Align left */
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    /* Reduced margin */
}

.expand-toggle .form-check {
    padding-left: 2.5em;
}

.expand-toggle .form-check-input {
    width: 3em;
    height: 1.5em;
    cursor: pointer;
    border: 2px solid #ddd;
}

.expand-toggle .form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.expand-toggle .form-check-label {
    font-weight: 500;
    color: var(--gray);
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

.expand-toggle .form-check-input:checked+.form-check-label {
    color: var(--primary-color);
}