/* ---------------------------------------------------
   GLOBAL
--------------------------------------------------- */

:root {
    --accent: #0078d4;
}

body.dark {
    --accent: #66b8ff;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f4f4;
    color: #333;
    transition: background 0.3s, color 0.3s;
}

body.dark {
    background: #1e1e1e;
    color: #eee;
}

/* ---------------------------------------------------
   PORTAL LAYOUT
--------------------------------------------------- */

.portal-container {
    display: flex;
    height: 100vh;
}

/* ---------------------------------------------------
   SIDEBAR
--------------------------------------------------- */

.sidebar {
    width: 240px;
    background: #ffffff;
    border-right: 1px solid #ddd;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

body.dark .sidebar {
    background: #2c2c2c;
    border-right: 1px solid #444;
}

.sidebar-header {
    text-align: center;
    margin-bottom: 30px;
}

.sidebar-logo {
    width: 60px;
    margin-bottom: 10px;
}

.sidebar-nav {
    flex-grow: 1;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav ul li {
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.sidebar-nav ul li:hover {
    background: #0078d4;
    color: white;
}

body.dark .sidebar-nav ul li:hover {
    background: #005a9e;
}

.sidebar-nav ul li.active {
    background: #0078d4;
    color: white;
    font-weight: 600;
}

body.dark .sidebar-nav ul li.active {
    background: #66b8ff;
    color: #000;
}

/* ---------------------------------------------------
   THEME SWITCHER
--------------------------------------------------- */

.theme-switcher {
    text-align: center;
    font-size: 1.4em;
    margin-bottom: 10px;
    user-select: none;
}

.theme-switcher span {
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
}

.theme-switcher span.active {
    background-color: #0078d4;
    color: white;
}

/* ---------------------------------------------------
   SIDEBAR FOOTER
--------------------------------------------------- */

.sidebar-footer {
    text-align: center;
    font-size: 0.8em;
    opacity: 0.6;
    margin-bottom: 10px;
}

.sidebar-footer a {
    color: inherit;
    text-decoration: none;
}

.sidebar-footer a:hover {
    text-decoration: underline;
    opacity: 1;
}

/* ---------------------------------------------------
   CONTENT AREA
--------------------------------------------------- */

.content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ---------------------------------------------------
   TOPBAR (HEADER)
--------------------------------------------------- */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background: #ffffff;
    border-bottom: 1px solid #ddd;
}

body.dark .topbar {
    background: #2c2c2c;
    border-bottom: 1px solid #444;
}

#pageActions {
    display: flex;
    align-items: center;
    gap: 10px;
}

#refreshButton {
    background-color: var(--accent);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

#refreshButton:disabled {
    opacity: 0.6;
    cursor: default;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 3px solid rgba(0,0,0,0.2);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

body.dark .spinner {
    border: 3px solid rgba(255,255,255,0.2);
    border-top: 3px solid var(--accent);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------------------------------------------------
   MODULE AREA
--------------------------------------------------- */

.module-area {
    padding: 30px;
}

body.dark .module-area {
    color: #eee;
}

/* ---------------------------------------------------
   MODULE BOXES
--------------------------------------------------- */

.module {
    background: var(--tile-bg, #fff);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
    color: var(--text-color, #333);
}

body.dark .module {
    background: #2c2c2c;
    color: #eee;
}

/* Upload-Box */

.upload-box {
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 10px;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

body.dark .upload-box {
    background: #1f1f1f;
    border-color: #444;
}

/* ---------------------------------------------------
   DASHBOARD
--------------------------------------------------- */

.dashboard h2 {
    margin-top: 0;
}

.dashboard .subtitle {
    margin-bottom: 25px;
    color: #666;
}

body.dark .dashboard .subtitle {
    color: #aaa;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.dashboard-card {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}

body.dark .dashboard-card {
    background: #2c2c2c;
}

.dashboard-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

.dashboard-card h3 {
    margin-top: 0;
}

.dashboard-card button {
    margin-top: 10px;
    padding: 8px 14px;
    border: none;
    background: #0078d4;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.dashboard-card button:hover {
    background: #005a9e;
}

body.dark .dashboard-card button {
    background: #66b8ff;
    color: #000;
}

body.dark .dashboard-card button:hover {
    background: #3399ff;
}

.card-logo {
    width: 32px;
    height: 32px;
    position: absolute;
    top: 15px;
    right: 15px;
    opacity: 0.9;
}

/* ---------------------------------------------------
   STATUS COLORS
--------------------------------------------------- */

.status-ok {
    color: limegreen;
    font-weight: bold;
}

.status-inactive {
    color: gray;
    font-weight: bold;
}
