/* --------------------------------------------------------------------------------
   Admin Panel Global Styles
----------------------------------------------------------------------------------- */

body {
    font-family: Arial, sans-serif;
    margin: 10px;
    background: #f9f9f9;
    color: #333;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 0 24px rgba(0,0,0,0.08);
}

h1, h2, h3 {
    color: #222;
    margin-top: 0;
    margin-bottom: 20px;
}

a {
    color: #1976d2;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 13px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

th, td {
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    text-align: left;
    vertical-align: middle;
}

th {
    background-color: #f3f3f3;
    position: sticky;
    top: 0;
    font-weight: bold;
}

tr:hover {
    background-color: #f5faff;
}

.button, button, input[type="submit"] {
    display: inline-block;
    padding: 7px 16px;
    background-color: #1976d2;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
    margin: 3px 2px;
    transition: background 0.2s;
    text-decoration: none;
}

.button:hover, button:hover, input[type="submit"]:hover {
    background-color: #125ea6;
}

.add-button { background-color: #388e3c; }
.add-button:hover { background-color: #236526; }
.delete-button { background-color: #d32f2f; }
.delete-button:hover { background-color: #9a2222; }
.edit-button { background-color: #0288d1; }
.edit-button:hover { background-color: #005c99; }

form {
    margin-top: 10px;
}

input, select, textarea {
    font-family: inherit;
    font-size: 13px;
    padding: 7px;
    margin: 5px 0 15px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
    background: #f9f9f9;
}

input[type="checkbox"], input[type="radio"] {
    width: auto;
    margin-right: 5px;
}

label {
    font-weight: 600;
    display: block;
    margin-bottom: 6px;
}

.success, .message.success {
    background: #e6f4ea;
    color: #257642;
    border: 1px solid #c1e3c8;
    padding: 12px;
    border-radius: 6px;
    margin: 15px 0;
}

.error, .message.error {
    background: #ffeaea;
    color: #c72e2e;
    border: 1px solid #f5b6b6;
    padding: 12px;
    border-radius: 6px;
    margin: 15px 0;
}

.info, .message.info {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #90caf9;
    padding: 12px;
    border-radius: 6px;
    margin: 15px 0;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.38);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #fff;
    margin: 7% auto;
    padding: 30px;
    border: 1px solid #bbb;
    width: 95%;
    max-width: 430px;
    border-radius: 10px;
    box-shadow: 0 4px 32px rgba(0,0,0,0.14);
    position: relative;
}

.modal-title {
    font-size: 1.2em;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
}

.modal-buttons {
    text-align: right;
    margin-top: 20px;
}

@media (max-width: 600px) {
    .container { padding: 7px; }
    .modal-content { width: 98%; }
    th, td { font-size: 11px; padding: 5px 6px; }
    button, .button { font-size: 11px; padding: 6px 10px; }
}

/* Misc */
.spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 2px solid #e0e0e0;
    border-top: 2px solid #1976d2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
    margin-left: 6px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

input[readonly], textarea[readonly] {
    background: #ececec;
    color: #888;
}

.empty {
    color: #888;
    font-style: italic;
}

/* Global Topbar Styles */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #333;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    z-index: 1000;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.top-bar .role {
    font-weight: bold;
    text-transform: uppercase;
}

.top-bar .logout-btn {
    background: #d32f2f;
    color: #fff;
    border: none;
    padding: 4px 16px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    text-decoration: none;
    display: inline-block;
    line-height: 18px;
}

.top-bar .logout-btn:hover {
    background: #b71c1c;
    text-decoration: none;
}

/* Adjust body padding for fixed top bar */
body.with-topbar {
    padding-top: 50px;
}

/* Role badge styles */
.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.role-view { background: #e3f2fd; color: #1565c0; }
.role-edit { background: #fff3cd; color: #856404; }
.role-admin { background: #d4edda; color: #155724; }
.role-root { background: #f8d7da; color: #721c24; }