/* Reset Dasar */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f4f4f4;
    color: #333;
    line-height: 1.6;
}

/* NAVBAR */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    padding: 1rem 5%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ff6b6b; /* Warna Oranye Kemerahan (Identik dengan playful) */
}

.nav-links {
    list-style: none;
    display: flex;
}

.nav-links li {
    margin: 0 15px;
}

.nav-links a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: #ff6b6b;
}

.btn-login {
    background-color: #333;
    color: #fff;
    padding: 8px 20px;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.3s;
}

.btn-login:hover {
    background-color: #ff6b6b;
}

/* HERO SECTION */
.hero {
    height: 90vh;
    background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('https://images.unsplash.com/photo-1548199973-03cce0bbc87b?ixlib=rb-1.2.1&auto=format&fit=crop&w=1950&q=80');
    background-size: cover;
    background-position: center;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #fff;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.btn-primary {
    background-color: #ff6b6b;
    color: #fff;
    padding: 12px 30px;
    text-decoration: none;
    border-radius: 5px;
    font-size: 1.1rem;
    transition: background 0.3s;
}

.btn-primary:hover {
    background-color: #e55050;
}

/* FEATURES SECTION */
.features {
    padding: 5rem 10%;
    text-align: center;
    background-color: #fff;
}

.features h2 {
    margin-bottom: 3rem;
    color: #333;
}

.feature-container {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 2rem;
}

.feature-card {
    background: #f9f9f9;
    padding: 2rem;
    border-radius: 10px;
    width: 300px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.feature-card:hover {
    transform: translateY(-10px);
}

.feature-card i {
    font-size: 3rem;
    color: #ff6b6b;
    margin-bottom: 1rem;
}

.feature-card h3 {
    margin-bottom: 1rem;
}

/* FOOTER */
footer {
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 3rem 0;
}

.footer-content h3 {
    margin-bottom: 1rem;
}

.socials {
    list-style: none;
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.socials li {
    margin: 0 10px;
}

.socials a {
    color: #fff;
    font-size: 1.5rem;
    transition: color 0.3s;
}

.socials a:hover {
    color: #ff6b6b;
}

.footer-bottom {
    margin-top: 2rem;
    font-size: 0.9rem;
    color: #bbb;
}

/* Responsiveness (Agar bagus di HP) */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        text-align: center;
    }
    .nav-links {
        margin-top: 1rem;
        margin-bottom: 1rem;
    }
    .hero h1 {
        font-size: 2rem;
    }
}

/* --- TAMPILAN HALAMAN LOGIN --- */

.login-wrapper {
    height: 100vh; /* Tinggi layar penuh */
    background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('https://images.unsplash.com/photo-1583337130417-3346a1be7dee?ixlib=rb-1.2.1&auto=format&fit=crop&w=1950&q=80');
    background-size: cover;
    background-position: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-box {
    background: #fff;
    padding: 2.5rem;
    border-radius: 10px;
    width: 100%;
    max-width: 400px; /* Batas lebar agar tidak terlalu lebar di layar besar */
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    text-align: center;
}

.login-header h2 {
    color: #ff6b6b;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #666;
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    text-align: left;
}

.input-group {
    text-align: left;
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.input-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.input-group input:focus {
    border-color: #ff6b6b;
    outline: none;
}

.btn-full {
    width: 100%;
    background-color: #ff6b6b;
    color: #fff;
    padding: 12px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-full:hover {
    background-color: #e55050;
}

.login-footer {
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.login-footer a {
    color: #ff6b6b;
    text-decoration: none;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* --- DASHBOARD STYLES --- */

.dashboard-container {
    display: flex; /* Membagi layar menjadi Sidebar & Main */
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: #333;
    color: #fff;
    padding: 20px;
}

.sidebar-logo h2 {
    color: #ff6b6b;
    margin-bottom: 2rem;
    text-align: center;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 1rem;
}

.sidebar-menu a {
    color: #ccc;
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 5px;
    transition: 0.3s;
}

.sidebar-menu a i {
    margin-right: 10px;
    width: 20px;
}

.sidebar-menu a:hover, .sidebar-menu a.active {
    background-color: #ff6b6b;
    color: #fff;
}

.logout {
    margin-top: 2rem;
    border-top: 1px solid #555;
    padding-top: 1rem;
}

/* Main Content */
.main-content {
    flex: 1; /* Mengambil sisa ruang layar */
    background-color: #f4f4f4;
    padding: 2rem;
}

/* Header dengan tanggal dan waktu */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-top h1 {
    margin: 0;
    color: #333;
}

.datetime-display {
    display: flex;
    gap: 2rem;
    font-size: 0.95rem;
    color: #555;
    background: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.datetime-display p {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.datetime-display i {
    color: #ff6b6b;
    font-size: 1.1rem;
}

.status-online {
    color: green;
    font-weight: bold;
}

.status-offline {
    color: #ff6b6b;
    font-weight: bold;
}

/* Panel Kontrol */
.control-panel {
    display: flex;
    gap: 20px;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.card {
    background: #fff;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    flex: 1;
    min-width: 300px;
    text-align: center;
}

/* Tombol Pakan Besar */
.btn-feed {
    background-color: #ff6b6b;
    color: white;
    border: none;
    width: 150px;
    height: 150px;
    border-radius: 50%; /* Membuat tombol bulat */
    font-size: 1.2rem;
    font-weight: bold;
    margin: 1.5rem 0;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
    transition: transform 0.1s, background 0.3s;
}

.btn-feed:active {
    transform: scale(0.95); /* Efek membal saat ditekan */
    background-color: #e55050;
}

.tank-level {
    background-color: #eee;
    border-radius: 20px;
    height: 30px;
    width: 100%;
    margin: 1rem 0;
    overflow: hidden;
}

.level-fill {
    background-color: #4CAF50;
    height: 100%;
    text-align: center;
    line-height: 30px;
    color: white;
    font-size: 0.8rem;
}

/* ========== SCHEDULE STYLES ========== */
#schedules-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.schedule-item {
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 8px;
    border: 2px solid #ddd;
    transition: all 0.3s;
}

.schedule-item:hover {
    border-color: #ff6b6b;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.2);
}

.schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #ddd;
}

.schedule-label {
    font-weight: bold;
    color: #333;
    font-size: 0.95rem;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #ff6b6b;
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.schedule-input-group {
    margin: 1rem 0;
}

.schedule-input-group label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
    text-align: left;
    font-weight: 600;
}

.schedule-time {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.95rem;
    cursor: pointer;
}

.schedule-time:focus {
    outline: none;
    border-color: #ff6b6b;
    box-shadow: 0 0 5px rgba(255, 107, 107, 0.3);
}

.btn-save-schedule {
    width: 100%;
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.3s;
}

.btn-save-schedule:hover {
    background-color: #45a049;
}

.btn-save-schedule:active {
    transform: scale(0.98);
}

.schedule-info {
    font-size: 0.85rem;
    color: #666;
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f0f0f0;
    border-left: 3px solid #ff6b6b;
    text-align: left;
}

/* --- UPDATE STATUS ALAT --- */
.status-online {
    color: #27ae60; /* Hijau */
    font-weight: bold;
}

.status-offline {
    color: #c0392b; /* Merah */
    font-weight: bold;
}

/* --- UPDATE JADWAL --- */
.schedule-input-group {
    margin: 20px 0;
    text-align: left;
}

.schedule-input-group input {
    width: 100%;
    padding: 10px;
    font-size: 1.2rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-top: 5px;
}

.btn-primary-small {
    background-color: #333;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
    transition: 0.3s;
}

.btn-primary-small:hover {
    background-color: #ff6b6b;
}

.current-schedule {
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    font-weight: bold;
    color: #555;
}

/* ========== TAB STYLES ========== */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.sidebar-menu a.tab-link {
    cursor: pointer;
}

/* ========== HISTORY PANEL ========== */
.history-panel {
    background: #fff;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.history-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.5rem;
}

.history-filters {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #fff;
    cursor: pointer;
    font-size: 0.95rem;
}

.filter-select:focus {
    outline: none;
    border-color: #ff6b6b;
}

.btn-refresh {
    background-color: #2196F3;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.3s;
}

.btn-refresh:hover {
    background-color: #1976D2;
}

.btn-refresh:active {
    transform: scale(0.95);
}

/* History Table */
.history-table-wrapper {
    overflow-x: auto;
    margin: 1.5rem 0;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
}

.history-table thead {
    background-color: #f5f5f5;
    border-bottom: 2px solid #ddd;
}

.history-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
}

.history-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

.history-table tbody tr:hover {
    background-color: #f9f9f9;
}

.feed-type-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.feed-type-badge.manual {
    background-color: #fff3cd;
    color: #856404;
}

.feed-type-badge.automatic {
    background-color: #d1ecf1;
    color: #0c5460;
}

.history-empty {
    text-align: center;
    padding: 3rem;
    color: #999;
    font-size: 1.1rem;
}

.history-error {
    text-align: center;
    padding: 3rem;
    color: #d32f2f;
    font-size: 1rem;
    background-color: #ffebee;
    border-radius: 5px;
}

/* Pagination */
#history-pagination {
    margin-top: 2rem;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination-btn {
    background-color: #fff;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.pagination-btn:hover {
    background-color: #ff6b6b;
    color: white;
    border-color: #ff6b6b;
}

.pagination-current {
    background-color: #ff6b6b;
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        padding: 15px;
    }

    .dashboard-container {
        flex-direction: column;
    }

    .main-content {
        padding: 1.5rem;
    }

    .header-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .datetime-display {
        flex-direction: column;
        gap: 0.5rem;
    }

    .control-panel {
        flex-direction: column;
    }

    .card {
        min-width: auto;
    }

    .history-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .history-table {
        font-size: 0.9rem;
    }

    .history-table th,
    .history-table td {
        padding: 8px;
    }

    .btn-feed {
        width: 120px;
        height: 120px;
        font-size: 1rem;
    }
}