/* General Styling */
:root {
    --primary-color: #4A90E2; /* Biru cerah */
    --secondary-color: #50E3C2; /* Tosca */
    --accent-color: #FF6B6B; /* Merah lembut */
    --text-color: #333;
    --light-text-color: #666;
    --background-color: #f4f7f6;
    --card-background: #fff;
    --border-color: #e0e0e0;
    --shadow-light: 0 4px 10px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 8px 20px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background-color: var(--card-background);
    padding: 15px 0;
    box-shadow: var(--shadow-light);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Untuk responsif */
}

.logo a {
    text-decoration: none;
    color: var(--primary-color);
    display: flex;
    align-items: center;
}

.logo img {
    height: 40px;
    margin-right: 10px;
}

.logo h1 {
    font-size: 1.8em;
    font-weight: 700;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 25px;
    flex-wrap: wrap; /* Untuk responsif */
}

nav ul li a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    padding: 5px 0;
    position: relative;
    transition: color 0.3s ease;
}

nav ul li a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

nav ul li a:hover {
    color: var(--primary-color);
}

nav ul li a:hover::after {
    width: 100%;
}

/* Main Content */
main {
    flex-grow: 1;
    padding: 30px 0;
}

/* Hero Section / Landing Page */
.hero-section {
    text-align: center;
    padding: 80px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: #fff;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-medium);
}

.hero-section h1 {
    font-size: 3em;
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero-section p {
    font-size: 1.2em;
    margin-bottom: 30px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.btn {
    display: inline-block;
    background-color: var(--accent-color);
    color: #fff;
    padding: 15px 30px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1em;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.btn:hover {
    background-color: #E25050;
    transform: translateY(-2px);
}

.btn-primary {
    background-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #3a7bd5;
}

.btn-secondary {
    background-color: var(--secondary-color);
}

.btn-secondary:hover {
    background-color: #3bd0af;
}


/* Forms */
.form-container {
    background-color: var(--card-background);
    padding: 30px;
    border-radius: 10px;
    box-shadow: var(--shadow-light);
    max-width: 500px;
    margin: 30px auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--light-text-color);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="file"],
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

button[type="submit"] {
    width: 100%;
    padding: 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

button[type="submit"]:hover {
    background-color: #3a7bd5;
    transform: translateY(-2px);
}

.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-weight: 600;
    animation: fadeIn 0.5s ease-out;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: var(--card-background);
    border-radius: 10px;
    overflow: hidden; /* Ensures border-radius applies to children */
    box-shadow: var(--shadow-light);
}

table thead {
    background-color: var(--primary-color);
    color: white;
}

table th,
table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

table tbody tr:hover {
    background-color: #f0f8ff;
}

table tbody tr:last-child td {
    border-bottom: none;
}

.action-buttons a {
    margin-right: 10px;
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.action-buttons a:hover {
    color: var(--accent-color);
}

/* Dashboard Cards */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.card {
    background-color: var(--card-background);
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow-light);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-medium);
}

.card h3 {
    font-size: 1.5em;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.card p {
    font-size: 2.5em;
    font-weight: 700;
    color: var(--text-color);
}

/* Redirect Page */
.redirect-container {
    background-color: var(--card-background);
    padding: 40px;
    border-radius: 15px;
    box-shadow: var(--shadow-medium);
    text-align: center;
    max-width: 700px;
    margin: 50px auto;
}

.redirect-container h2 {
    color: var(--primary-color);
    font-size: 2em;
    margin-bottom: 20px;
}

.redirect-info {
    margin-bottom: 30px;
    font-size: 1.1em;
    color: var(--light-text-color);
}

.redirect-countdown {
    font-size: 3em;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 30px;
}

.link-preview {
    margin-top: 30px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.link-preview h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.link-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.link-preview p {
    font-size: 1em;
    word-break: break-all;
    color: var(--text-color);
}

/* Admin Nav */
.admin-nav {
    margin-bottom: 30px;
    background-color: var(--card-background);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow-light);
}

.admin-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.admin-nav ul li a {
    display: block;
    padding: 10px 20px;
    background-color: var(--background-color);
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.admin-nav ul li a:hover,
.admin-nav ul li a.active {
    background-color: var(--primary-color);
    color: white;
}

/* Footer */
footer {
    background-color: var(--text-color);
    color: #fff;
    text-align: center;
    padding: 20px 0;
    margin-top: auto; /* Push footer to bottom */
    font-size: 0.9em;
}

/* Ads Styling */
.ad-banner {
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background-color: #fffacd; /* Light yellow background for ads */
    border: 1px dashed #ffd700;
    border-radius: 8px;
    font-size: 0.9em;
    color: #5a4b00;
}

/* Responsive Design */
@media (max-width: 768px) {
        nav {
        position: fixed;
        top: 0;
        right: -300px;
        width: 280px;
        max-width: 80%;
        height: 100%;
        background-color: #FFF;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
        transition: right 0.3s ease-in-out;
        z-index: 1100; /* Naikin supaya di atas overlay */
        padding-top: 80px;
        overflow-y: auto;
    }

    nav.active {
        right: 0;
        pointer-events: auto;
    }

    .overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.6);
        z-index: 1000;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
    }

    nav ul {
        margin-top: 15px;
        justify-content: center;
    }

    .hero-section h1 {
        font-size: 2.2em;
    }

    .hero-section p {
        font-size: 1em;
    }

    .form-container, .redirect-container {
        margin: 20px auto;
        padding: 25px;
    }

    table th, table td {
        padding: 10px;
        font-size: 0.9em;
    }

    .admin-nav ul {
        flex-direction: column;
        align-items: center;
    }

    .admin-nav ul li {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.5em;
    }

    nav ul {
        flex-direction: column;
        gap: 10px;
    }

    .hero-section {
        padding: 50px 15px;
    }

    .btn {
        padding: 12px 25px;
        font-size: 1em;
    }

    .redirect-countdown {
        font-size: 2.5em;
    }
}
