/* Base body styling */
body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    display: flex;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

#main-content-index {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* --- Base Styles (Theme-Independent) --- */
.button {
    border-radius: 15px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    font-weight: bold;
    text-decoration: none;
    transition: box-shadow 0.3s ease, background 0.3s ease, color 0.3s ease, text-shadow 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
}
.sidebar {
    width: 280px;
    padding: 20px;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    overflow-y: auto;
    flex-shrink: 0;
    transition: background-color 0.3s ease;
}
.logo-placeholder {
    width: 100%;
    height: 80px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 2.5rem;
    margin-bottom: 20px;
    box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}
.main-content {
    flex-grow: 1;
    padding: 40px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

#main-content-index .button-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

#main-content-index .button-row {
    display: flex;
    gap: 10px;
}

.sidebar-button {
     justify-content: space-between;
     width: 100%;
     max-width: 260px;
    }

.led-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #a7a7a7;
    margin-left: 10px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
    transition: background-color 0.6s ease-in-out, box-shadow 0.6s ease-in-out;
    flex-shrink: 0;
}

/* --- Light Theme (Default) --- */
body.theme-light {
    background-color: #ECECEC;
    color: #333;
    --theme-panel-background: #fff; /* Define the variable */
    --theme-text-h: #4A5568; /* Define the variable */
    --theme-text-p: #718096; /* Define the variable */
    --theme-settings-label: #4A5568; /* Define the variable */
    --theme-settings-select-border: #e2e8f0; /* Define the variable */
    --theme-settings-select-background: #fff; /* Define the variable */
    --theme-settings-select-color: #333; /* Define the variable */

}
body.theme-light .sidebar { background-color: #f0f0f0; }
body.theme-light .logo-placeholder { background-color: #d1d1d1; color: #7f7f7f; }
body.theme-light .button {
    background: #ECECEC;
    color: #7f7f7f;
    text-shadow: 0px 1px 0px #fff;
    border: 1px solid #a7a7a7;
    box-shadow: 0px 2px 1px white inset, 0px -2px 8px white, 0px 2px 5px rgba(0, 0, 0, 0.1), 0px 8px 10px rgba(0, 0, 0, 0.1);
}
body.theme-light .button:hover {
    box-shadow: 0px 2px 1px white inset, 0px -2px 20px white, 0px 2px 5px rgba(0, 0, 0, 0.1), 0px 8px 10px rgba(0, 0, 0, 0.1);
}
body.theme-light .button:active, body.theme-light .button.active-state {
    background: linear-gradient(to bottom, #d1d1d1 0%, #ECECEC 100%);
    box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.5) inset, 0px -2px 20px white, 0px 1px 5px rgba(0, 0, 0, 0.1), 0px 2px 10px rgba(0, 0, 0, 0.1);
}
body.theme-light .theme-panel { background-color: var(--theme-panel-background); }
body.theme-light .theme-text-h { color: var(--theme-text-h); }
body.theme-light .theme-text-p { color: var(--theme-text-p); }
body.theme-light .settings-panel { background-color: var(--theme-panel-background); }
body.theme-light .settings-label { color: var(--theme-settings-label); }
body.theme-light .settings-select { border-color: var(--theme-settings-select-border); background-color: var(--theme-settings-select-background); color: var(--theme-settings-select-color); }


/* --- Dark Theme --- */
body.theme-dark {
    background-color: #1A202C;
    color: #E2E8F0;
    --theme-panel-background: #2D3748; /* Define the variable */
    --theme-text-h: #E2E8F0; /* Define the variable */
    --theme-text-p: #A0AEC0; /* Define the variable */
    --theme-settings-label: #E2E8F0; /* Define the variable */
    --theme-settings-select-border: #718096; /* Define the variable */
    --theme-settings-select-background: #4A5568; /* Define the variable */
    --theme-settings-select-color: #E2E8F0; /* Define the variable */
}
body.theme-dark .sidebar { background-color: #2D3748; }
body.theme-dark .logo-placeholder { background-color: #4A5568; color: #A0AEC0; }
body.theme-dark .button {
    background: #2D3748;
    color: #A0AEC0;
    text-shadow: none;
    border: 1px solid #4A5568;
    box-shadow: 0px 2px 1px rgba(255,255,255,0.05) inset, 0px -2px 8px rgba(0,0,0,0.5), 0px 2px 5px rgba(0,0,0,0.3), 0px 8px 10px rgba(0,0,0,0.3);
}
body.theme-dark .button:hover {
    box-shadow: 0px 2px 1px rgba(255,255,255,0.1) inset, 0px -2px 20px rgba(0,0,0,0.7), 0px 2px 5px rgba(0,0,0,0.3), 0px 8px 10px rgba(0,0,0,0.3);
}
body.theme-dark .button:active, body.theme-dark .button.active-state {
    background: linear-gradient(to bottom, #1A202C 0%, #2D3748 100%);
    box-shadow: 0px 1px 2px rgba(0,0,0,0.8) inset, 0px -2px 20px rgba(0,0,0,0.5), 0px 1px 5px rgba(0,0,0,0.3), 0px 2px 10px rgba(0,0,0,0.3);
}
body.theme-dark .theme-panel { background-color: var(--theme-panel-background); }
body.theme-dark .theme-text-h { color: var(--theme-text-h); }
body.theme-dark .theme-text-p { color: var(--theme-text-p); }
body.theme-dark .settings-panel { background-color: var(--theme-panel-background); }
body.theme-dark .settings-label { color: var(--theme-settings-label); }
body.theme-dark .settings-select { border-color: var(--theme-settings-select-border); background-color: var(--theme-settings-select-background); color: var(--theme-settings-select-color); }


/* --- Oceanic Theme --- */
body.theme-oceanic {
    background-color: #0B192F;
    color: #ccd6f6;
    --theme-panel-background: #112240; /* Define the variable */
    --theme-text-h: #ccd6f6; /* Define the variable */
    --theme-text-p: #8892b0; /* Define the variable */
    --theme-settings-label: #ccd6f6; /* Define the variable */
    --theme-settings-select-border: #64ffda; /* Define the variable */
    --theme-settings-select-background: #0B192F; /* Define the variable */
    --theme-settings-select-color: #ccd6f6; /* Define the variable */
}
body.theme-oceanic .sidebar { background-color: #020c1b; }
body.theme-oceanic .logo-placeholder { background-color: var(--theme-panel-background); color: #64ffda; }
body.theme-oceanic .button {
    background: var(--theme-panel-background);
    color: #8892b0;
    text-shadow: none;
    border: 1px solid #020c1b;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
body.theme-oceanic .button:hover {
    color: #64ffda;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}
body.theme-oceanic .button:active, body.theme-oceanic .button.active-state {
    background: linear-gradient(to bottom, #112240 0%, #0B192F 100%);
    color: #64ffda;
}
body.theme-oceanic .theme-panel { background-color: var(--theme-panel-background); }
body.theme-oceanic .theme-text-h { color: var(--theme-text-h); }
body.theme-oceanic .theme-text-p { color: var(--theme-text-p); }
body.theme-oceanic .settings-panel { background-color: var(--theme-panel-background); }
body.theme-oceanic .settings-label { color: var(--theme-settings-label); }
body.theme-oceanic .settings-select { border-color: var(--theme-settings-select-border); background-color: var(--theme-settings-select-background); color: var(--theme-settings-select-color); }


/* --- Global Marine Theme --- */
body.theme-global-marine {
    background-color: #f8f9fa;
    color: #001f3f;
    --theme-panel-background: #ffffff; /* Define the variable */
    --theme-text-h: #001f3f; /* Define the variable */
    --theme-text-p: #495057; /* Define the variable */
    --theme-settings-label: #001f3f; /* Define the variable */
    --theme-settings-select-border: #ced4da; /* Define the variable */
    --theme-settings-select-background: #ffffff; /* Define the variable */
    --theme-settings-select-color: #001f3f; /* Define the variable */
}
body.theme-global-marine .sidebar { background-color: #001f3f; }
body.theme-global-marine .logo-placeholder { background-color: var(--theme-panel-background); color: #001f3f; border: 1px solid #dee2e6; }
body.theme-global-marine .button {
    background: #f8f9fa;
    color: #001f3f;
    text-shadow: none;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
body.theme-global-marine .sidebar .button {
    background: #002b55;
    color: #f8f9fa;
    border-color: #001f3f;
}
body.theme-global-marine .button:hover {
    background-color: #ffffff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
body.theme-global-marine .sidebar .button:hover {
     background-color: #003b75;
}
body.theme-global-marine .button:active, body.theme-global-marine .button.active-state {
    background: #ffffff;
    border-color: #001f3f;
}
body.theme-global-marine .sidebar .button:active, body.theme-global-marine .sidebar .button.active-state {
    background: linear-gradient(to bottom, #002b55 0%, #001f3f 100%);
}
body.theme-global-marine .theme-panel { background-color: var(--theme-panel-background); border: 1px solid #dee2e6; }
body.theme-global-marine .theme-text-h { color: var(--theme-text-h); }
body.theme-global-marine .theme-text-p { color: var(--theme-text-p); }
body.theme-global-marine .settings-panel { background-color: var(--theme-panel-background); border: 1px solid #dee2e6;}
body.theme-global-marine .settings-label { color: var(--theme-settings-label); }
body.theme-global-marine .settings-select { border-color: var(--theme-settings-select-border); background-color: var(--theme-settings-select-background); color: var(--theme-settings-select-color); }


/* LED Color Schemes */
body.led-dark-red .led-indicator.on { background-color: #C53030; box-shadow: 0 0 8px #C53030, 0 0 15px #C53030; }
body.led-red .led-indicator.on { background-color: #F87171; box-shadow: 0 0 8px #F87171, 0 0 15px #F87171; }
body.led-dark-orange .led-indicator.on { background-color: #E69500; box-shadow: 0 0 8px #E69500, 0 0 15px #E69500; }
body.led-orange .led-indicator.on { background-color: #FB923C; box-shadow: 0 0 8px #FB923C, 0 0 15px #FB923C; }
body.led-dark-green .led-indicator.on { background-color: #16A34A; box-shadow: 0 0 8px #16A34A, 0 0 15px #16A34A; }
body.led-green .led-indicator.on { background-color: #4ADE80; box-shadow: 0 0 8px #4ADE80, 0 0 15px #4ADE80; }

/* Match maintenance button active border to LED color */
body.led-dark-red .maintenance-button.active-state { border-color: #C53030; }
body.led-red .maintenance-button.active-state { border-color: #F87171; }
body.led-dark-orange .maintenance-button.active-state { border-color: #E69500; }
body.led-orange .maintenance-button.active-state { border-color: #FB923C; }
body.led-dark-green .maintenance-button.active-state { border-color: #16A3A; }
body.led-green .maintenance-button.active-state { border-color: #4ADE80; }

/* Content panel styling */
.content-panel { display: none; width: 100%; height: 100%; animation: fadeIn 0.5s ease-in-out; }
.maintenance-subpanel { display: none; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Responsive adjustments */
@media (max-width: 768px) {
body { flex-direction: column; }
.sidebar { width: 100%; height: auto; padding: 10px; flex-direction: row; flex-wrap: wrap; justify-content: center; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); }
.sidebar-button { width: 45%; margin: 5px; font-size: 0.9rem; padding: 10px 15px; }
.main-content { padding: 20px; }
#dashboard-content { flex-direction: column !important; }
#dashboard-content > div { width: 100% !important; }
}

/* --- Login Page Styles --- */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    padding: 20px;
    background-image: url('images/login.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.login-panel {
    background-color: var(--theme-panel-background); /* Using CSS variable for theme consistency */
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.login-title {
    font-size: 2rem;
    font-weight: bold;
    color: var(--theme-text-h); /* Using CSS variable for theme consistency */
    margin-bottom: 20px;
}

.google-sign-in-button {
    /* Styles similar to your existing buttons */
    border-radius: 15px;
    padding: 12px 20px;
    display: inline-flex; /* Use inline-flex for button */
    align-items: center;
    font-weight: bold;
    text-decoration: none;
    transition: box-shadow 0.3s ease, background 0.3s ease, color 0.3s ease, text-shadow 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
    /* Theme-specific styles will be inherited or can be added here */
}

/* Consider adding specific theme overrides for the Google button if needed */
/*
body.theme-light .google-sign-in-button {
    background: #ECECEC;
    color: #7f7f7f;
    text-shadow: 0px 1px 0px #fff;
    border: 1px solid #a7a7a7;
    box-shadow: 0px 2px 1px white inset, 0px -2px 8px white, 0px 2px 5px rgba(0, 0, 0, 0.1), 0px 8px 10px rgba(0, 0, 0, 0.1);
}
*/

/* Utility class to hide content initially */
.hidden-content {
    display: none;
}