/* Custom CSS Variables for Komdigi Color Scheme */
:root {
    --primary-color: #1C67B8; /* Biru dari logo */
    --secondary-color: #38A3A5; /* Hijau kebiruan dari logo */
    --accent-color-red: #DC3545; /* Merah dari heart icon, atau bisa disesuaikan */
    --accent-color-yellow: #F0B300; /* Kuning dari logo */
    --dark-text-color: #343a40; /* Warna teks gelap */
    --light-bg-color: #f8f9fa; /* Warna latar belakang terang */
    --card-bg-color: #ffffff; /* Warna latar belakang card */
    --shadow-color: rgba(0, 0, 0, 0.1); /* Warna bayangan */
    --navbar-height: 70px; /* Tinggi navbar */
    --sidebar-width: 280px; /* Lebar sidebar */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg-color);
    color: var(--dark-text-color);
    display: flex; /* Menggunakan flexbox untuk tata letak halaman */
    flex-direction: column; /* Menyusun item secara vertikal */
    min-height: 100vh; /* Memastikan body mengisi seluruh tinggi viewport */
    margin: 0; /* Menghilangkan margin default body */
}

/* Navbar adjustments */
.navbar {
    background-color: var(--card-bg-color);
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px var(--shadow-color);
    z-index: 1030; /* Pastikan navbar di atas konten lain */
}

.navbar-brand img {
    height: 35px; /* Mengurangi tinggi logo dari 40px menjadi 35px */
    margin-right: 10px;
}

.navbar-brand .brand-text {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: bold;
}

.admin-login-btn {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transition: all 0.3s ease;
}

.admin-login-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Main Content and Profile Card for index.php */
.main-content { /* Ini untuk index.php */
    padding-top: var(--navbar-height); /* Offset untuk navbar tetap */
    padding-bottom: 50px; /* Default untuk desktop */
    flex-grow: 1; /* Membuatnya mengisi ruang yang tersedia */
    display: flex; /* Mempertahankan flex untuk pemusatan horizontal card */
    flex-direction: column;
    align-items: center; /* Memusatkan card secara horizontal */
    /* justify-content-center dihapus untuk memungkinkan ekspansi vertikal card */
}

.profile-card {
    background-color: var(--card-bg-color);
    max-width: 500px; /* Default max-width */
    width: 90%;
    margin: 40px auto; /* Margin atas dan bawah untuk jarak dari navbar/footer */
    box-shadow: 0 4px 15px var(--shadow-color);
    border-radius: 15px;
    transition: transform 0.3s ease;
}

.profile-card:hover {
    transform: translateY(-5px);
}

.profile-pic {
    width: 90px;
    height: 90px;
    border-radius: 40%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
    box-shadow: 0 2px 8px var(--shadow-color);
}

.profile-name {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 2.2rem;
}

.profile-bio {
    color: #6c757d;
    font-size: 1.1rem;
}

/* Link Button Styling (for index.php) */
.link-item-btn {
    background-color: var(--card-bg-color);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    font-weight: bold;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    min-height: 60px; /* Minimum height for buttons */
}

.link-item-btn:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.link-item-btn .link-icon {
    color: var(--primary-color); /* Icon color */
}

.link-item-btn:hover .link-icon {
    color: white; /* Icon color on hover */
}

/* Animation for link items */
.link-item-animation {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInSlideUp 0.5s forwards ease-out;
}

@keyframes fadeInSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Footer Styling */
.footer {
    background-color: var(--primary-color);
    color: white;
    border-top: 1px solid #e9ecef;
    box-shadow: 0 -2px 4px var(--shadow-color);
    z-index: 1030; /* Ensure footer is above other content but below modals */
    /* Menambahkan properti untuk memastikan footer selalu di bagian bawah */
    width: 100%;
    flex-shrink: 0; /* Mencegah footer menyusut */
}

.footer span, .footer p {
    color: white !important; /* Override default text-muted for white text */
    margin-bottom: 0;
}


/* Modals */
.modal-content {
    border-radius: 10px;
    box-shadow: 0 5px 15px var(--shadow-color);
}

.modal-header {
    background-color: var(--primary-color);
    color: white;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

.modal-title {
    font-weight: bold;
}

.modal-body {
    padding: 2rem;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.btn-primary:hover {
    background-color: #16529C; /* Slightly darker primary */
    border-color: #16529C;
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
    transition: all 0.3s ease;
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Custom Message Modal */
.custom-modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1060; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    display: flex; /* Always use flex for better centering */
    justify-content: center;
    align-items: center;
}

.custom-modal-content {
    background-color: var(--card-bg-color);
    margin: auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 400px;
    border-radius: 8px;
    text-align: center;
    position: relative;
    box-shadow: 0 5px 15px var(--shadow-color);
}

.custom-modal-close {
    color: #aaa;
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 28px;
    font-weight: bold;
}

.custom-modal-close:hover,
.custom-modal-close:focus {
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
}

/* Dashboard Specific Styles (for dashboard_links.php) */
.main-page-content {
    padding-top: var(--navbar-height); /* Offset for fixed navbar */
    padding-bottom: 80px; /* Space for fixed footer */
}

/* Auth Section before login (for dashboard_login.php) */
/* .auth-container { Dihapus karena sudah ada .login-page-content di dashboard_login.php */
/* background-color: var(--light-bg-color); */
/* padding-top: 20px; */
/* } */

/* .auth-container .auth-logo { Dihapus dari sini, pindah ke .login-page-content .auth-logo */
/* width: 120px; */
/* height: auto; */
/* border-radius: 0; */
/* box-shadow: none; */
/* } */

/* New styles for dashboard_login.php */
.login-page-content {
    background-color: var(--light-bg-color);
    padding-top: var(--navbar-height); /* Offset from fixed navbar */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - var(--navbar-height) - 70px); /* Adjust height */
    text-align: center;
}

.login-page-content .auth-logo {
    width: 120px;
    height: auto;
    margin-bottom: 2rem;
}

.login-page-content h2 {
    margin-bottom: 1rem;
}

.login-page-content p {
    margin-bottom: 2rem;
}

.login-page-content .btn-group .btn {
    margin: 0 0.5rem;
}


/* Dashboard Layout (After Login, for dashboard_links.php) */
.dashboard-layout {
    align-items: flex-start;
}

/* Sidebar (for dashboard_links.php) */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    padding-top: 20px;
    border-right: 1px solid #e0e0e0;
    height: 100%;
    position: sticky;
    top: var(--navbar-height);
    align-self: flex-start;
    overflow-y: auto;
}

.sidebar .profile-pic {
    width: 80px;
    height: 80px;
    border-width: 2px !important;
}

.sidebar .nav-link {
    color: var(--dark-text-color);
    padding: 10px 15px;
    border-radius: 5px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar .nav-link.active {
    background-color: var(--primary-color);
    color: white;
}

.sidebar .nav-link:hover:not(.active) {
    background-color: rgba(var(--primary-color-rgb, 28, 103, 184), 0.1);
    color: var(--primary-color);
}

/* Main Content Area next to sidebar (for dashboard_links.php) */
.main-content-area {
    flex-grow: 1;
    background-color: #f0f2f5;
    padding: 20px;
    overflow-y: auto;
}

.links-container {
    background-color: var(--card-bg-color);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px var(--shadow-color);
}

/* Link Item Styling (for dashboard) */
.link-item {
    background-color: var(--light-bg-color);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
    font-size: 1.1rem;
    position: relative;
}

.link-item:hover {
    background-color: #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.link-item .link-title {
    color: var(--primary-color);
    font-weight: 500;
}

.link-item .link-actions button {
    background: none;
    border: none;
    color: #6c757d;
    font-size: 1rem;
    padding: 5px;
    transition: color 0.2s ease;
}

.link-item .link-actions button:hover {
    color: var(--primary-color);
}

.link-item .link-actions .delete-link-btn:hover {
    color: var(--accent-color-red);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .navbar-brand .brand-text {
        font-size: 1.2rem;
    }

    .main-content { /* Sesuaikan padding-bottom untuk mobile/tablet */
        padding-bottom: 10px; /* Diubah dari 20px menjadi 10px */
    }

    .profile-card { /* Untuk index.php */
        margin: 20px auto;
        padding: 20px;
    }

    .profile-name { /* Untuk index.php */
        font-size: 1.8rem;
    }

    .profile-bio { /* Untuk index.php */
        font-size: 1rem;
    }

    .link-item-btn { /* Untuk index.php */
        font-size: 1rem;
        padding: 15px;
    }

    /* Dashboard mobile adjustments (for dashboard_links.php) */
    .dashboard-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding-bottom: 15px;
        position: relative;
        top: 0;
    }

    .sidebar .profile-section {
        margin-bottom: 15px;
    }

    .sidebar .nav-item {
        margin-bottom: 5px;
    }
    
    .sidebar .nav-link {
        text-align: center;
    }

    .sidebar .mt-auto.pt-3 {
        border-top: none;
    }

    .main-content-area {
        padding: 15px;
    }
    
    /* Responsive for link buttons in index.php */
    #publicLinksList {
        flex-direction: column;
        align-items: stretch;
    }
    .link-item-btn {
        max-width: 100%;
    }
}

/* For larger screens, distribute buttons */
@media (min-width: 769px) {
    #publicLinksList { /* Untuk index.php */
        display: grid;
        /* Mengatur agar maksimal 4 kolom dengan lebar minimum 210px */
        grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
        gap: 20px;
        padding: 0 15px;
    }

    .link-item-btn { /* Untuk index.php */
        width: auto;
        max-width: 350px;
        margin: auto;
    }
}

/* Menyesuaikan lebar profile-card untuk menampung lebih banyak kolom di desktop */
@media (min-width: 992px) {
    .profile-card {
        max-width: 900px; /* Memperluas lebar kartu untuk menampung 4 kolom */
    }
}