/* Fluent UI / Azure Portal inspired styles */

:root {
    /* Light Theme Colors */
    --primary-color: #0078d4;
    --primary-hover: #106ebe;
    --primary-pressed: #005a9e;
    --background-primary: #ffffff;
    --background-secondary: #f8f9fa;
    --background-tertiary: #f3f2f1;
    --text-primary: #323130;
    --text-secondary: #605e5c;
    --text-tertiary: #8a8886;
    --border-primary: #e9ecef;
    --border-secondary: #d1d1d1;
    --border-tertiary: #edebe9;
    --success-color: #107c10;
    --success-background: #f7fef7;
    --success-border: #b5f1ae;
    --error-color: #d13438;
    --error-background: #fef7f7;
    --error-border: #f1aeb5;
    --warning-color: #ff8c00;
    --warning-background: #fff8f0;
    --warning-border: #ffcc99;
    --shadow-small: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 2px 8px rgba(0, 0, 0, 0.12);
    --shadow-large: 0 4px 16px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] {
    /* Dark Theme Colors - Más suaves */
    --primary-color: #ff6b9d;
    --primary-hover: #ff8fb3;
    --primary-pressed: #ff4785;
    --background-primary: #2d2d2d;
    --background-secondary: #1e1e1e;
    --background-tertiary: #404040;
    --text-primary: #f0f0f0;
    --text-secondary: #d0d0d0;
    --text-tertiary: #a0a0a0;
    --border-primary: #555555;
    --border-secondary: #666666;
    --border-tertiary: #777777;
    --success-color: #4caf50;
    --success-background: #1b2e1b;
    --success-border: #2e7e2e;
    --error-color: #f44336;
    --error-background: #2e1b1b;
    --error-border: #7e2e2e;
    --warning-color: #ff9800;
    --warning-background: #2e251b;
    --warning-border: #7e5f2e;
}

/* Global Styles */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', 'Segoe UI Web (West European)', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-primary);
    background-color: var(--background-secondary);
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Remove border radius from all elements for sharp Fluent UI look */
* {
    border-radius: 0 !important;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.6rem;
}

h3 {
    font-size: 1.3rem;
}

h4 {
    font-size: 1.1rem;
}

h5 {
    font-size: 1rem;
}

h6 {
    font-size: 0.9rem;
}

p {
    margin: 0 0 1rem 0;
    color: var(--text-secondary);
}

/* Form Elements */
input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    color: var(--text-primary);
    background-color: var(--background-primary);
    border: 1px solid var(--border-secondary);
    padding: 0.5rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

    input:focus, textarea:focus, select:focus {
        outline: none;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 1px var(--primary-color);
    }

    input::placeholder, textarea::placeholder {
        color: var(--text-tertiary);
    }

/* Buttons */
.btn, button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    border: 1px solid var(--border-secondary);
    background-color: var(--background-primary);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

    .btn:hover, button:hover {
        background-color: var(--background-tertiary);
    }

    .btn:active, button:active {
        transform: translateY(1px);
    }

    .btn:disabled, button:disabled {
        background-color: var(--background-tertiary);
        color: var(--text-tertiary);
        cursor: not-allowed;
        transform: none;
    }

/* Primary Button */
.btn-primary, .primary-button {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

    .btn-primary:hover, .primary-button:hover:not(:disabled) {
        background-color: var(--primary-hover);
        border-color: var(--primary-hover);
    }

    .btn-primary:active, .primary-button:active {
        background-color: var(--primary-pressed);
        border-color: var(--primary-pressed);
    }

/* Success Button */
.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

    .btn-success:hover:not(:disabled) {
        background-color: #0e5a0e;
        border-color: #0e5a0e;
    }

/* Danger Button */
.btn-danger {
    background-color: var(--error-color);
    border-color: var(--error-color);
    color: white;
}

    .btn-danger:hover:not(:disabled) {
        background-color: #a4262c;
        border-color: #a4262c;
    }

/* Cards */
.card {
    background-color: var(--background-primary);
    border: 1px solid var(--border-primary);
    box-shadow: var(--shadow-small);
    transition: box-shadow 0.2s ease;
}

    .card:hover {
        box-shadow: var(--shadow-medium);
    }

.card-header {
    background-color: var(--background-secondary);
    border-bottom: 1px solid var(--border-primary);
    padding: 1rem;
}

.card-body {
    padding: 1rem;
}

.card-footer {
    background-color: var(--background-secondary);
    border-top: 1px solid var(--border-primary);
    padding: 0.75rem 1rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.alert-success {
    background-color: var(--success-background);
    border-color: var(--success-border);
    color: var(--success-color);
}

.alert-danger {
    background-color: var(--error-background);
    border-color: var(--error-border);
    color: var(--error-color);
}

.alert-warning {
    background-color: var(--warning-background);
    border-color: var(--warning-border);
    color: var(--warning-color);
}

.alert-info {
    background-color: #e3f2fd;
    border-color: #bbdefb;
    color: #1976d2;
}

/* Utilities */
.text-primary {
    color: var(--primary-color) !important;
}

.text-success {
    color: var(--success-color) !important;
}

.text-danger {
    color: var(--error-color) !important;
}

.text-warning {
    color: var(--warning-color) !important;
}

.text-muted {
    color: var(--text-tertiary) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.bg-light {
    background-color: var(--background-secondary) !important;
}

.bg-white {
    background-color: var(--background-primary) !important;
}

.border {
    border: 1px solid var(--border-primary) !important;
}

.shadow-sm {
    box-shadow: var(--shadow-small) !important;
}

.shadow {
    box-shadow: var(--shadow-medium) !important;
}

.shadow-lg {
    box-shadow: var(--shadow-large) !important;
}

/* Blazor Error UI */
#blazor-error-ui {
    background: var(--error-background);
    bottom: 0;
    box-shadow: var(--shadow-large);
    display: none;
    left: 0;
    padding: 1rem;
    position: fixed;
    right: 0;
    z-index: 1000;
    border-top: 1px solid var(--error-border);
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 1rem;
        top: 0.5rem;
        color: var(--error-color);
        font-size: 1.2rem;
    }

.blazor-error-boundary {
    background: var(--error-background);
    border: 1px solid var(--error-border);
    color: var(--error-color);
    padding: 1rem;
    margin: 1rem 0;
}

/* Loading states */
.loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

    .loading::before {
        content: "";
        width: 1rem;
        height: 1rem;
        border: 2px solid var(--border-tertiary);
        border-top: 2px solid var(--primary-color);
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* TinyMCE overrides */
.tox-tinymce {
    border: 1px solid var(--border-secondary) !important;
}

.tox .tox-toolbar,
.tox .tox-toolbar__overflow,
.tox .tox-toolbar__primary {
    background-color: var(--background-secondary) !important;
    border-bottom: 1px solid var(--border-primary) !important;
}

.tox .tox-edit-area__iframe {
    background-color: var(--background-primary) !important;
}

[data-theme="dark"] .tox-tinymce {
    background-color: var(--background-primary) !important;
}

[data-theme="dark"] .tox .tox-edit-area__iframe {
    background-color: var(--background-primary) !important;
}

/* Aplicar tema oscuro a todos los elementos principales */
[data-theme="dark"] body {
    background-color: var(--background-secondary) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .header {
    background-color: var(--background-primary) !important;
    border-bottom-color: var(--border-primary) !important;
}

[data-theme="dark"] .sidebar {
    background-color: var(--background-primary) !important;
    border-right-color: var(--border-primary) !important;
}

[data-theme="dark"] .main-panel {
    background-color: var(--background-secondary) !important;
}

[data-theme="dark"] .question-editor {
    background-color: var(--background-secondary) !important;
}

[data-theme="dark"] .text-input {
    background-color: var(--background-primary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-secondary) !important;
}

[data-theme="dark"] .question-title-input {
    background-color: var(--background-primary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-secondary) !important;
}

[data-theme="dark"] .exam-header {
    background-color: var(--background-tertiary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .question-node {
    background-color: var(--background-primary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .editor-header {
    background-color: var(--background-secondary) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] label {
    color: var(--text-primary) !important;
}

[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3, [data-theme="dark"] h4 {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .tox .tox-toolbar {
    background-color: var(--background-tertiary) !important;
}

[data-theme="dark"] .tox .tox-edit-area {
    background-color: var(--background-primary) !important;
}

[data-theme="dark"] .tox-edit-area iframe {
    background-color: var(--background-primary) !important;
}


/* Sidebar elementos específicos */
[data-theme="dark"] .sidebar-header {
    background-color: var(--background-secondary) !important;
    border-bottom-color: var(--border-primary) !important;
}

[data-theme="dark"] .sidebar-content {
    background-color: var(--background-primary) !important;
}

[data-theme="dark"] .new-exam-button {
    background-color: var(--primary-color) !important;
    color: white !important;
}

[data-theme="dark"] .add-question-button {
    background-color: var(--background-tertiary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-secondary) !important;
}

[data-theme="dark"] .exam-actions {
    background-color: var(--background-primary) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .questions-list {
    background-color: var(--background-primary) !important;
    border-color: var(--border-primary) !important;
}

/* Botones del header */
[data-theme="dark"] .settings-button, [data-theme="dark"] .logout-button {
    background-color: var(--background-tertiary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-secondary) !important;
}

/* TinyMCE toolbar completa */
[data-theme="dark"] .tox:not(.tox-tinymce-inline) .tox-editor-header {
    background-color: var(--background-tertiary) !important;
    border-bottom-color: var(--border-primary) !important;
}

[data-theme="dark"] .tox .tox-toolbar__primary {
    background-color: var(--background-tertiary) !important;
}

[data-theme="dark"] .tox .tox-tbtn {
    color: var(--text-primary) !important;
}

    [data-theme="dark"] .tox .tox-tbtn:hover {
        background-color: var(--background-secondary) !important;
    }

[data-theme="dark"] .tox .tox-tbtn__select-label {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .tox .tox-listbox__select-label {
    color: var(--text-primary) !important;
}

/* Lista de preguntas dentro del examen */
[data-theme="dark"] .questions-list .question-node {
    background-color: var(--background-primary) !important;
    color: var(--text-primary) !important;
    border-bottom-color: var(--border-primary) !important;
}

    [data-theme="dark"] .questions-list .question-node:hover {
        background-color: var(--background-tertiary) !important;
    }

    [data-theme="dark"] .questions-list .question-node.selected {
        background-color: var(--background-tertiary) !important;
        border-left-color: var(--primary-color) !important;
    }

[data-theme="dark"] .question-icon {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .question-title {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .question-tags {
    color: var(--primary-color) !important;
}

/* Contenido dentro del iframe de TinyMCE */
[data-theme="dark"] .tox .tox-edit-area__iframe {
    background-color: var(--background-primary) !important;
}

/* Mejorar iconos de TinyMCE */
[data-theme="dark"] .tox .tox-tbtn svg {
    fill: var(--text-primary) !important;
}

[data-theme="dark"] .tox .tox-tbtn:hover svg {
    fill: var(--primary-color) !important;
}

[data-theme="dark"] .tox .tox-toolbar__group {
    border-color: var(--border-secondary) !important;
}

[data-theme="dark"] .tox .tox-split-button {
    color: var(--text-primary) !important;
}

    [data-theme="dark"] .tox .tox-split-button:hover {
        background-color: var(--background-secondary) !important;
    }

/* Modal de Settings */
[data-theme="dark"] .modal-content-large {
    background-color: var(--background-primary) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .settings-page {
    background-color: var(--background-primary) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .settings-section {
    background-color: var(--background-secondary) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .settings-header {
    background-color: var(--background-primary) !important;
    border-bottom-color: var(--border-primary) !important;
}

[data-theme="dark"] .readonly-value {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .current-storage {
    background-color: var(--background-tertiary) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .storage-option, [data-theme="dark"] .theme-option {
    border-color: var(--border-primary) !important;
    background-color: var(--background-primary) !important;
}

    [data-theme="dark"] .storage-option:hover, [data-theme="dark"] .theme-option:hover {
        background-color: var(--background-tertiary) !important;
    }

[data-theme="dark"] .azure-config {
    background-color: var(--background-tertiary) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .connection-string-input {
    background-color: var(--background-primary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-secondary) !important;
}

[data-theme="dark"] .user-admin-section {
    background-color: var(--background-tertiary) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .users-header {
    background-color: var(--background-secondary) !important;
    border-bottom-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .user-row {
    border-bottom-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}

    [data-theme="dark"] .user-row.current-user {
        background-color: var(--background-secondary) !important;
        border-left-color: var(--primary-color) !important;
    }

[data-theme="dark"] .search-input, [data-theme="dark"] .form-input {
    background-color: var(--background-primary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-secondary) !important;
}

[data-theme="dark"] .stat-item {
    background-color: var(--background-tertiary) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .stat-number {
    color: var(--primary-color) !important;
}

[data-theme="dark"] .stat-label {
    color: var(--text-secondary) !important;
}

/* Search Drawer */
[data-theme="dark"] .search-drawer {
    background-color: var(--background-primary) !important;
}

[data-theme="dark"] .search-drawer-header {
    background-color: var(--background-secondary) !important;
    border-bottom-color: var(--border-primary) !important;
}

[data-theme="dark"] .search-drawer-content {
    background-color: var(--background-primary) !important;
}

[data-theme="dark"] .exam-group {
    border-color: var(--border-primary) !important;
    background-color: var(--background-secondary) !important;
}

[data-theme="dark"] .exam-group-header {
    background-color: var(--background-tertiary) !important;
    border-bottom-color: var(--border-primary) !important;
}

[data-theme="dark"] .search-result-item {
    border-bottom-color: var(--border-primary) !important;
}

    [data-theme="dark"] .search-result-item:hover {
        background-color: var(--background-tertiary) !important;
    }

[data-theme="dark"] .result-header h4 {
    color: var(--primary-color) !important;
}

[data-theme="dark"] .matched-text {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .match-location {
    background-color: var(--background-tertiary) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .hashtag {
    background-color: var(--background-tertiary) !important;
    color: var(--primary-color) !important;
}

[data-theme="dark"] .no-results {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .search-tips {
    background-color: var(--background-tertiary) !important;
}

/* Etiquetas y labels en Settings */
[data-theme="dark"] .setting-item label {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .user-name {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .storage-option label strong, [data-theme="dark"] .theme-option label strong {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .storage-option label small, [data-theme="dark"] .theme-option label small {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .form-group label {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .user-admin-section h4 {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .settings-section h3 {
    color: var(--text-primary) !important;
    border-bottom-color: var(--border-primary) !important;
}

[data-theme="dark"] .users-table .user-email {
    color: var(--primary-color) !important;
}

[data-theme="dark"] .users-table .user-date {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .badge.admin {
    background-color: var(--error-background) !important;
    color: var(--error-color) !important;
    border-color: var(--error-border) !important;
}

[data-theme="dark"] .badge.user {
    background-color: var(--success-background) !important;
    color: var(--success-color) !important;
    border-color: var(--success-border) !important;
}

[data-theme="dark"] .current-user-label {
    color: var(--text-tertiary) !important;
}

/* Fechas en el editor header */
[data-theme="dark"] .question-dates-editor {
    color: var(--text-secondary) !important;
}

    [data-theme="dark"] .question-dates-editor .date-item {
        color: var(--text-secondary) !important;
    }

/* Fechas en el sidebar */
[data-theme="dark"] .question-dates {
    color: var(--text-secondary) !important;
}

    [data-theme="dark"] .question-dates .date-item {
        color: var(--text-secondary) !important;
    }

/* Footer/bottom de TinyMCE */
[data-theme="dark"] .tox .tox-statusbar {
    background-color: var(--background-tertiary) !important;
    border-top-color: var(--border-primary) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .tox .tox-statusbar__text-container {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .tox .tox-statusbar__path {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .tox .tox-statusbar__wordcount {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .tox .tox-statusbar a {
    color: var(--primary-color) !important;
}

/* Modal de nueva pregunta */
[data-theme="dark"] .modal-overlay {
    background-color: rgba(0, 0, 0, 0.7) !important;
}

[data-theme="dark"] .modal-content {
    background-color: var(--background-primary) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}

    [data-theme="dark"] .modal-content h3 {
        color: var(--text-primary) !important;
    }

[data-theme="dark"] .form-group label {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .form-input {
    background-color: var(--background-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-secondary) !important;
}

    [data-theme="dark"] .form-input:focus {
        border-color: var(--primary-color) !important;
    }

[data-theme="dark"] .modal-actions {
    background-color: var(--background-primary) !important;
}

/* Modal de confirmación de borrado */
[data-theme="dark"] .delete-modal {
    background-color: var(--background-primary) !important;
}

[data-theme="dark"] .user-to-delete {
    background-color: var(--background-tertiary) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .warning-text {
    color: var(--error-color) !important;
}


/* Modal de nueva pregunta - fondo y elementos */
[data-theme="dark"] .modal-content {
    background-color: var(--background-primary) !important;
}

    [data-theme="dark"] .modal-content h3 {
        background-color: var(--background-primary) !important;
        color: var(--text-primary) !important;
    }

[data-theme="dark"] .form-group {
    background-color: var(--background-primary) !important;
}

    [data-theme="dark"] .form-group label {
        color: var(--text-primary) !important;
        background-color: var(--background-primary) !important;
    }

[data-theme="dark"] .modal-actions {
    background-color: var(--background-primary) !important;
}

[data-theme="dark"] .question-title-input {
    background-color: var(--background-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-secondary) !important;
}

[data-theme="dark"] .secondary-button {
    background-color: var(--background-tertiary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-secondary) !important;
}

/* Botón cerrar en Settings header */
[data-theme="dark"] .back-button {
    background-color: var(--background-tertiary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-secondary) !important;
}

    [data-theme="dark"] .back-button:hover {
        background-color: var(--background-secondary) !important;
    }

[data-theme="dark"] .close-drawer-button {
    background-color: transparent !important;
    color: var(--text-secondary) !important;
}

    [data-theme="dark"] .close-drawer-button:hover {
        color: var(--text-primary) !important;
    }


/* Estados de respuesta en tema oscuro */
[data-theme="dark"] .question-node.answer-correct {
    background-color: #2d4a2d !important;
    border-left-color: #4caf50 !important;
}

[data-theme="dark"] .question-node.answer-incorrect {
    background-color: #4a2d2d !important;
    border-left-color: #f44336 !important;
}

[data-theme="dark"] .question-node.selected.answer-correct {
    background-color: #3d5a3d !important;
    border-left-color: #4caf50 !important;
}

[data-theme="dark"] .question-node.selected.answer-incorrect {
    background-color: #5a3d3d !important;
    border-left-color: #f44336 !important;
}

/* Asegurar que el hover funcione */
[data-theme="dark"] .question-node.answer-correct:hover {
    background-color: #3d5a3d !important;
}

[data-theme="dark"] .question-node.answer-incorrect:hover {
    background-color: #5a3d3d !important;
}

/* ===========================================
   GLOBAL RESPONSIVE UTILITIES
   =========================================== */

/* Ensure all interactive elements are touch-friendly */
@media (max-width: 767px) {
    button, .btn, input[type="button"], input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
    }

    input, textarea, select {
        min-height: 44px;
        font-size: 16px; /* Prevent zoom on iOS */
        touch-action: manipulation;
    }

        /* Better focus visibility on mobile */
        input:focus, textarea:focus, select:focus, button:focus {
            outline: 2px solid var(--primary-color);
            outline-offset: 2px;
        }

    /* Improve scroll behavior */
    body {
        -webkit-overflow-scrolling: touch;
        overflow-x: hidden;
    }

    /* Prevent horizontal scroll */
    * {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Better tap targets */
    a, button, input, select, textarea, [onclick] {
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    }
}

/* High DPI / Retina adjustments */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .spinner {
        border-width: 1px;
    }

    /* Sharper borders on high DPI */
    .border, .card, .modal-content {
        border-width: 0.5px;
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .sidebar {
        transition: none !important;
    }
}

/* Dark theme improvements for mobile */
@media (max-width: 767px) {
    [data-theme="dark"] input,
    [data-theme="dark"] textarea,
    [data-theme="dark"] select {
        background-color: var(--background-primary) !important;
        color: var(--text-primary) !important;
        border-color: var(--border-secondary) !important;
    }

    [data-theme="dark"] button,
    [data-theme="dark"] .btn {
        background-color: var(--background-tertiary) !important;
        color: var(--text-primary) !important;
        border-color: var(--border-secondary) !important;
    }

    [data-theme="dark"] .primary-button {
        background-color: var(--primary-color) !important;
        color: white !important;
        border-color: var(--primary-color) !important;
    }
}

/* Print styles - Hide interactive elements when printing */
@media print {
    .header, .sidebar, .toolbar-btn, .mobile-menu-btn {
        display: none !important;
    }

    .main-panel {
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }

    .rich-editor-content {
        border: none !important;
        box-shadow: none !important;
    }
}



/* === ESTILOS PARA SCROLLBARS === */

/* Para navegadores WebKit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 8px !important; /* Ancho de la scrollbar vertical */
    height: 8px !important; /* Alto de la scrollbar horizontal */
}

::-webkit-scrollbar-track {
    background: #3c3c3c !important; /* Fondo del track/riel - más claro */
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #666666 !important; /* Color del thumb/manija - más claro */
    border-radius: 4px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: #808080 !important; /* Color al hacer hover */
    }

    ::-webkit-scrollbar-thumb:active {
        background: #999999 !important; /* Color al hacer clic */
    }

::-webkit-scrollbar-corner {
    background: #3c3c3c !important; /* Esquina donde se cruzan scrollbars */
}

/* Asegurar que se aplique a todos los elementos */
* {
    scrollbar-width: thin;
    scrollbar-color: #666666 #3c3c3c;
}

html ::-webkit-scrollbar {
    width: 8px !important;
    height: 8px !important;
}

html ::-webkit-scrollbar-track {
    background: #3c3c3c !important;
    border-radius: 4px;
}

html ::-webkit-scrollbar-thumb {
    background: #666666 !important;
    border-radius: 4px;
}

/* Para Firefox */
* {
    scrollbar-width: thin; /* auto | thin | none */
    scrollbar-color: #464647 #2d2d30; /* thumb track */
}

/* === VARIANTE ALTERNATIVA MÁS MODERNA === */
/* Descomenta esta sección si prefieres un diseño más moderno */

/*
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

::-webkit-scrollbar-thumb:active {
    background: rgba(255, 255, 255, 0.7);
}
*/



