/* basicnya */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #db451b71;
}

header {
    background: #ff0000cf;
    color: #ffffff;
    padding: 20px 0;
    text-align: center;
    position: relative;
}

/* Loading buat login */
.spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* buat kolom loginnya */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f5f5f5;
}

.login-card {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h1 {
    color: #333;
    margin-bottom: 1.5rem;
}

/* Dashboard Status Indicatornya */
.status-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s ease;
}

.status-badge::before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-on {
    background-color: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
}

.status-on::before {
    background-color: #4CAF50;
}

.status-off {
    background-color: rgba(244, 67, 54, 0.1);
    color: #F44336;
}

.status-off::before {
    background-color: #F44336;
}

/* Laman loginnya */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

#login-form {
    background: white;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.input-field {
    padding: 12px;
    margin: 10px 0;
    width: 80%;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.login-btn {
    background-color: #4285f4;
    color: white;
    padding: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    width: 100%;
    margin-top: 10px;
}

.error-message {
    color: #f44336;
    padding: 10px 0;
    text-align: center;
}

/* buat dashboardnya */
.container {
    display: flex;
    flex-direction: column;
    padding: 10px;
}

.card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin: 10px 0;
    padding: 15px;
}

.data-display {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.data-item {
    text-align: center;
    padding: 10px;
}

.data-item i {
    font-size: 2.5em;
    color: #35424a;
}

/* indikator status daya */
.status-indicator {
    margin: 15px 0;
    text-align: center;
}

.status-badge {
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: bold;
    display: inline-block;
}

.status-on {
    background-color: #4CAF50;
    color: white;
}

.status-off {
    background-color: #F44336;
    color: white;
}

/* tabel */
canvas {
    width: 100% !important;
    height: 200px !important;
    margin-top: 10px;
}

#history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

#history-table th, 
#history-table td {
    padding: 8px;
    text-align: center;
    border: 1px solid rgb(199, 8, 8);
}

#history-table th {
    background-color: #f8f8f8;
}

/* buat tampilan di hp */
@media (min-width: 600px) {
    .data-display {
        grid-template-columns: 1fr 1fr;
    }
    
    .container {
        padding: 15px;
    }
    
    .card {
        padding: 20px;
    }
    #history-table {
        width: 100%;
    }
}

/* buat tampilan di lepii */
@media (min-width: 900px) {
    .container {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
    }
    
    .card {
        flex: 1 1 calc(50% - 20px);
        margin: 10px;
    }
    
    .data-display {
        grid-template-columns: 1fr 1fr 1fr 1fr;
    }
    
    #history-table {
        font-size: 16px;
    }
    
    .logout-btn {
        padding: 8px 16px;
        font-size: 16px;
    }
}

.loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.5em;
}

.loading.active {
    display: flex;
}

/* buat relay */
.relay-control {
    margin: 15px 0;
    text-align: center;
}

.relay-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.relay-btn {
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.relay-btn.status-on {
    background-color: #4CAF50;
    color: white;
}

.relay-btn.status-off {
    background-color: #F44336;
    color: white;
}

/* buat hp nya */
@media (max-width: 599px) {
    .relay-buttons {
        flex-direction: column;
        align-items: center;
    }
    .relay-btn {
        width: 80%;
    }
    .card {
        overflow-x: auto;
    }
}
