:root {
    /* XPTO Design System - cores da página de login */
    --color-bg: #ffffff;
    --color-surface-dark: #000000;
    --color-surface-dark-text: #ffffff;
    --color-primary: #28a745;
    --color-primary-hover: #218838;
    --color-primary-focus: rgba(40, 167, 69, 0.3);
    --color-border: #dee2e6;
    --color-text: #212529;
    --color-text-muted: #6c757d;
    --color-error: #f8d7da;
    --color-error-text: #721c24;
    --color-success-bg: rgba(40, 167, 69, 0.2);
    --color-success-border: rgba(40, 167, 69, 0.5);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-bg);
}

.admin-container {
    display: grid;
    grid-template-areas:
        "header header"
        "sidebar content"
        "footer footer";
    grid-template-columns: 200px 1fr;
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
}

.admin-header {
    grid-area: header;
    background: var(--color-surface-dark);
    color: var(--color-surface-dark-text);
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--color-surface-dark-text);
}

.admin-logo {
    height: 28px;
    width: auto;
    object-fit: contain;
}

.admin-header-brand span {
    font-size: 1.1rem;
    font-weight: 600;
}

.admin-header-logout {
    margin: 0;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.admin-header .btn-sm {
    background: transparent;
    color: var(--color-surface-dark-text);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.admin-header .btn-sm:hover {
    background: rgba(255, 255, 255, 0.1);
}

.admin-sidebar {
    grid-area: sidebar;
    background: var(--color-bg);
    border-right: 1px solid var(--color-border);
    padding: 1rem 0;
}

.admin-sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.admin-sidebar a {
    display: block;
    padding: 0.5rem 1.5rem;
    color: var(--color-text);
    text-decoration: none;
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
    background: var(--color-surface-dark);
    color: var(--color-surface-dark-text);
}

.admin-content {
    grid-area: content;
    padding: 1.5rem;
}

.admin-footer {
    grid-area: footer;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    border-top: 1px solid var(--color-border);
}

.alert {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.alert-success {
    background: var(--color-success-bg);
    border: 1px solid var(--color-success-border);
    color: var(--color-text);
}

.alert-error {
    background: var(--color-error);
    border: 1px solid var(--color-error-text);
    color: var(--color-error-text);
}

.btn {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-bg);
    color: var(--color-text);
    cursor: pointer;
    text-decoration: none;
}

.btn:hover {
    background: #f8f9fa;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
}

.btn-danger {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
    border-color: #ffc107;
}

.btn-warning:hover {
    background: #e0a800;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

th {
    font-weight: 600;
    background: var(--color-surface-dark);
    color: var(--color-surface-dark-text);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    max-width: 400px;
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-focus);
}

.form-group textarea {
    min-height: 80px;
}

.form-group input[type="checkbox"] {
    width: auto;
    max-width: none;
    margin-right: 0.5rem;
}

.form-actions {
    margin-top: 1.5rem;
}

.form-actions .btn {
    margin-right: 0.5rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.token-block {
    background: #f8f9fa;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
    word-break: break-all;
    font-family: monospace;
    font-size: 0.8rem;
}

.token-block pre {
    margin: 0;
    white-space: pre-wrap;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 4px;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

.badge-info {
    background: rgba(0, 123, 255, 0.15);
    color: #004085;
    border: 1px solid rgba(0, 123, 255, 0.3);
}

.badge-warning {
    background: rgba(255, 193, 7, 0.2);
    color: #856404;
    border: 1px solid rgba(255, 193, 7, 0.5);
}

.form-hint {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

.form-error {
    font-size: 0.8rem;
    color: var(--color-error-text);
    margin-top: 0.25rem;
}

/* Home - Language switch */
.page-header-home {
    flex-wrap: wrap;
    gap: 0.75rem;
}

.lang-switch {
    display: flex;
    gap: 0.5rem;
}

.lang-switch .btn-sm {
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.lang-switch .btn-sm:hover,
.lang-switch .btn-sm.active {
    background: var(--color-surface-dark);
    color: var(--color-surface-dark-text);
    border-color: var(--color-surface-dark);
}

/* Doc content - Markdown rendered */
.doc-content {
    max-width: 800px;
    line-height: 1.6;
}

.doc-content h1 {
    font-size: 1.5rem;
    margin: 1.5rem 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.doc-content h1:first-child {
    margin-top: 0;
}

.doc-content h2 {
    font-size: 1.25rem;
    margin: 1.25rem 0 0.5rem;
}

.doc-content h3 {
    font-size: 1.1rem;
    margin: 1rem 0 0.5rem;
}

.doc-content p {
    margin: 0 0 0.75rem;
}

.doc-content ul,
.doc-content ol {
    margin: 0 0 0.75rem;
    padding-left: 1.5rem;
}

.doc-content li {
    margin-bottom: 0.25rem;
}

.doc-content blockquote {
    margin: 0.75rem 0;
    padding: 0.5rem 1rem;
    border-left: 4px solid var(--color-primary);
    background: var(--color-success-bg);
    color: var(--color-text);
}

.doc-content code {
    background: #f8f9fa;
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.doc-content pre {
    background: #f8f9fa;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 1rem;
    overflow-x: auto;
    margin: 0.75rem 0;
}

.doc-content pre code {
    background: none;
    padding: 0;
}

.doc-content table {
    margin: 0.75rem 0;
}

.doc-content img {
    max-width: 100%;
    height: auto;
}

.doc-content a {
    color: var(--color-primary);
    text-decoration: none;
}

.doc-content a:hover {
    text-decoration: underline;
}

.doc-content hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 1.5rem 0;
}
