/* assets/css/style.css */

/* --- Font & Color Palette --- */
:root {
    --font-primary: 'Titillium Web', sans-serif;
    --font-accent: 'Orbitron', sans-serif;
    --color-bg-dark: #1a1c23;
    --color-bg-light: #252830;
    --color-surface: #2c303a;
    --color-primary: #00aaff;
    --color-secondary: #00f0c0;
    --color-text-primary: #e4e6eb;
    --color-text-secondary: #b0b3b8;
    --color-border: #444a5b;
    --color-success: #28a745;
    --color-error: #dc3545;
    --color-warning: #ff8c00; /* Orange for warning/impersonation */
    --impersonation-bar-height: 50px;
    --header-height: 65px;
}

/* --- Base Styles & Resets --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-primary);
    background-color: var(--color-bg-dark);
    color: var(--color-text-primary);
    line-height: 1.6;
    font-size: 16px;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-accent);
    color: var(--color-primary);
    margin-bottom: 1rem;
    letter-spacing: 1px;
}

h2 {
    font-size: 2rem;
}
h3 {
    font-size: 1.5rem;
}
h4 {
    font-size: 1.2rem;
    color: var(--color-secondary);
}


a {
    color: var(--color-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--color-primary);
}

ul {
    list-style: none;
}

/* --- Layout Containers --- */
.container, .main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.main-container {
    padding-top: calc(var(--header-height) + 20px);
    padding-bottom: 1rem;
    transition: padding-top 0.3s ease;
}
body.impersonating-active .main-container {
    padding-top: calc(var(--header-height) + var(--impersonation-bar-height) + 20px);
}

.content {
    background-color: var(--color-bg-light);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* --- Page Header for Content Area --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.page-header h2 {
    margin-bottom: 0;
}


/* --- Header & Navigation --- */
.header {
    background-color: var(--color-bg-light);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
    height: var(--header-height);
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    transition: top 0.3s ease;
}

.logo a {
    font-family: var(--font-accent);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}


.navigation ul {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.navigation a {
    color: var(--color-text-secondary);
    font-weight: 600;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: color 0.3s, border-color 0.3s;
}

.navigation a:hover, .navigation a.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* --- Dropdown Menu System --- */
.dropdown, .dropdown-submenu {
    position: relative;
}

.dropdown-menu, .dropdown-menu-submenu {
    display: flex;
    flex-direction: column;
    position: absolute;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 5px;
    padding: 0.5rem 0;
    z-index: 1001;
    min-width: 200px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.dropdown-menu {
    top: 100%;
    left: 0;
}

.dropdown:hover > .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li, .dropdown-menu-submenu li {
    width: 100%;
}

.dropdown-menu a, .dropdown-menu-submenu a {
    display: block;
    padding: 0.75rem 1rem;
    width: 100%;
    border-bottom: none;
}
.dropdown-menu a:hover, .dropdown-menu-submenu a:hover {
    background-color: rgba(0, 170, 255, 0.1);
}

.dropdown-menu-submenu {
    top: -0.5rem;
    left: 100%;
    transform: translateX(10px);
}
.dropdown-submenu:hover > .dropdown-menu-submenu {
     opacity: 1;
     visibility: visible;
     transform: translateX(0);
}
.dropdown-submenu > a.active {
    color: var(--color-primary) !important;
    background-color: rgba(0, 170, 255, 0.05);
}

.dropdown-menu-submenu a.active {
    background-color: rgba(0, 170, 255, 0.1);
}


/* --- Impersonation Bar --- */
.impersonation-bar {
    background-color: var(--color-warning);
    color: var(--color-bg-dark);
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1001;
    height: var(--impersonation-bar-height);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.impersonation-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.impersonation-bar span {
    font-weight: 600;
}

.impersonation-bar .button.button-warning {
    background-color: var(--color-bg-dark);
    color: var(--color-text-primary);
    padding: 0.4rem 1rem;
    flex-shrink: 0;
}

.impersonation-bar .button.button-warning:hover {
    background-color: #fff;
    color: var(--color-bg-dark);
}

body.impersonating-active .header {
    top: var(--impersonation-bar-height);
}


/* --- Generic Components & Forms --- */
hr {
    border: 0;
    border-top: 1px solid var(--color-border);
    margin: 2rem 0;
}

.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}
.form-actions {
    margin-top: 1.5rem;
}
.form-text {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin-top: 0.5rem;
}

/* --- Table Styles --- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    white-space: nowrap;
    border-bottom: none;
    vertical-align: middle;
}

th {
    font-family: var(--font-accent);
    font-weight: 700;
}

thead {
    border-bottom: 1px solid var(--color-border);
}

tbody tr {
    border-bottom: 1px solid var(--color-border);
}

tbody tr:last-child {
    border-bottom: none;
}

tr:hover {
    background-color: var(--color-surface);
}

td.actions-cell {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
td.actions-cell form {
    margin-bottom: 0;
}


input[type="text"],
input[type="password"],
input[type="email"],
input[type="file"],
input[type="number"],
select {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--color-bg-dark);
    border: 1px solid var(--color-border);
    border-radius: 5px;
    color: var(--color-text-primary);
    font-family: var(--font-primary);
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(0, 170, 255, 0.3);
}

/* --- Button Styles --- */
button, a.button {
    background-color: var(--color-primary);
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    font-family: var(--font-accent);
    font-weight: 700;
    transition: background-color 0.3s, transform 0.2s;
    display: inline-block;
    text-align: center;
}

button:hover, a.button:hover {
    background-color: var(--color-secondary);
    color: var(--color-bg-dark);
    transform: translateY(-2px);
}

button:disabled {
    background-color: var(--color-border);
    cursor: not-allowed;
    transform: none;
}

.button-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}
.button-danger {
    background-color: var(--color-error);
}
.button-danger:hover {
    background-color: #ff4d62;
    color: #fff;
}
.button-warning {
     background-color: var(--color-warning);
}
.button-warning:hover {
    background-color: #ffae42;
    color: var(--color-bg-dark);
}


/* --- Specific Components --- */
.message {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 5px;
    border: 1px solid;
}

.message.success {
    background-color: rgba(40, 167, 69, 0.1);
    border-color: var(--color-success);
    color: var(--color-success);
}

.message.error {
    background-color: rgba(220, 53, 69, 0.1);
    border-color: var(--color-error);
    color: var(--color-error);
}

/* --- Card System --- */
.card {
    background-color: var(--color-surface);
    border-radius: 8px;
    border: 1px solid var(--color-border);
    padding: 0;
    margin-bottom: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-header h4, .card-header h2 {
    margin: 0;
}

.card-body {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-body-table {
    padding: 0;
}
.card-body-table .table-responsive {
    margin-bottom: 0;
}
.card-body-table table {
    margin-bottom: 0;
}
.card-body-table table th,
.card-body-table table td {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}
.card-body-table > div:first-child:not(.table-responsive) {
    padding: 1.5rem;
    padding-bottom: 0;
}

.card-body p {
    flex-grow: 1;
    color: var(--color-text-secondary);
}

.card-body .button {
    margin-top: 1rem;
    align-self: flex-start;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

/* --- Dashboard Specific --- */
.dashboard-header {
    text-align: center;
    margin-bottom: 2rem;
}
.dashboard-header p {
    color: var(--color-text-secondary);
    font-size: 1.1rem;
}

.section-title {
    margin: 2rem 0 1.5rem 0;
}

/* --- Graph & Spinner Styles --- */
.graph-container .card-body {
     padding-top: 0;
}
.graph-controls {
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.graph-controls .graph-btn {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
}
.graph-controls .graph-btn.active,
.graph-controls .graph-btn:hover {
    background-color: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.graph-image-wrapper {
    position: relative;
}
.graph-container img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    background-color: #fff;
    transition: opacity 0.3s ease;
}
.spinner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(44, 48, 58, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: 5px;
}
.spinner {
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-left-color: var(--color-secondary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}


/* --- Modal Styles (REVISED FOR CENTERING) --- */
.modal {
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--color-bg-light);
    padding: 2rem;
    border: 1px solid var(--color-border);
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
    position: relative;
    transform: translateY(-50px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.modal#customConfirmModal .modal-content {
    max-width: 400px;
}
.modal p {
    color: var(--color-text-secondary);
    margin: 1rem 0 1.5rem 0;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}


/* --- Footer --- */
.footer {
    text-align: center;
    padding: 1.5rem 0;
    margin-top: -5rem;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}
