 :root {
            --primary-color: #4361ee;
            --primary-dark: #3a56d4;
            --secondary-color: #7209b7;
            --accent-color: #4cc9f0;
            --success-color: #4bb543;
            --error-color: #e63946;
            --warning-color: #ff9e00;
            --text-dark: #2b2d42;
            --text-light: #8d99ae;
            --bg-light: #f8f9fa;
            --bg-white: #ffffff;
            --shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
            --shadow-hover: 0 15px 30px rgba(0, 0, 0, 0.15);
            --border-radius: 12px;
            --transition: all 0.3s ease;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: var(--text-dark);
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            padding: 20px;
            line-height: 1.6;
        }

        .container {
            background-color: var(--bg-white);
            border-radius: var(--border-radius);
            box-shadow: var(--shadow);
            padding: 30px;
            width: 100%;
            max-width: 800px;
            height: 90vh;
            display: flex;
            flex-direction: column;
            transition: var(--transition);
        }

        .toolbar {
            display: flex;
            gap: 12px;
            margin-bottom: 20px;
            flex-wrap: wrap;
            align-items: center;
        }

        .toolbar-btn {
            padding: 10px 16px;
            border: 2px solid var(--primary-color);
            background: transparent;
            color: var(--primary-color);
            border-radius: var(--border-radius);
            cursor: pointer;
            transition: var(--transition);
            font-weight: 600;
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            gap: 6px;
        }

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

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

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

        .toolbar-btn.danger {
            border-color: var(--error-color);
            color: var(--error-color);
        }

        .toolbar-btn.danger:hover {
            background: var(--error-color);
            color: white;
        }

        .toolbar-btn.success {
            border-color: var(--success-color);
            color: var(--success-color);
        }

        .toolbar-btn.success:hover {
            background: var(--success-color);
            color: white;
        }

        .status-indicator {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-left: auto;
            font-size: 0.9rem;
            color: var(--text-light);
        }

        .status-dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background: var(--success-color);
            animation: pulse 2s infinite;
        }

        .status-dot.offline {
            background: var(--error-color);
        }

        .status-dot.syncing {
            background: var(--warning-color);
        }

        @keyframes pulse {
            0% { opacity: 1; }
            50% { opacity: 0.5; }
            100% { opacity: 1; }
        }

        .notes-sidebar {
            width: 250px;
            background: var(--bg-light);
            border-radius: var(--border-radius);
            padding: 20px;
            margin-right: 20px;
            display: flex;
            flex-direction: column;
        }

        .notes-list {
            flex: 1;
            overflow-y: auto;
            margin-bottom: 15px;
        }

        .note-item {
            padding: 12px;
            border-radius: var(--border-radius);
            margin-bottom: 8px;
            cursor: pointer;
            transition: var(--transition);
            border-left: 4px solid transparent;
        }

        .note-item:hover {
            background: rgba(67, 97, 238, 0.1);
        }

        .note-item.active {
            background: var(--primary-color);
            color: white;
            border-left-color: var(--secondary-color);
        }

        .note-title {
            font-weight: 600;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .note-preview {
            font-size: 0.8rem;
            opacity: 0.7;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .note-date {
            font-size: 0.7rem;
            opacity: 0.5;
            margin-top: 4px;
        }

        .main-content {
            flex: 1;
            display: flex;
            gap: 20px;
            min-height: 0;
        }

        .editor-container {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: var(--bg-light);
            border-radius: var(--border-radius);
            padding: 25px;
        }

        .note-title-input, .note-content {
            background: none;
            border: none;
            resize: none;
            font-family: inherit;
            padding: 10px;
            border-radius: var(--border-radius);
        }

        .note-title-input:focus, .note-content:focus {
            outline: none;
            background: white;
            box-shadow: 0 0 0 2px var(--primary-color);
        }

        .note-title-input {
            font-size: 1.4rem;
            font-weight: 700;
            color: var(--text-dark);
            margin-bottom: 15px;
        }

        .note-content {
            flex: 1;
            font-size: 1rem;
            line-height: 1.6;
            color: var(--text-dark);
        }

        .note-info {
            margin-top: 15px;
            padding-top: 15px;
            border-top: 1px solid rgba(0, 0, 0, 0.1);
            font-size: 0.8rem;
            color: var(--text-light);
            display: flex;
            justify-content: space-between;
        }

        .stats {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
            margin-top: 20px;
            padding-top: 20px;
            border-top: 1px solid rgba(0, 0, 0, 0.1);
        }

        .stat-item {
            text-align: center;
        }

        .stat-number {
            font-size: 1.2rem;
            font-weight: 700;
            color: var(--primary-color);
        }

        .stat-label {
            font-size: 0.7rem;
            color: var(--text-light);
        }

        .search-box {
            position: relative;
            margin-bottom: 15px;
        }

        .search-input {
            width: 100%;
            padding: 10px 35px 10px 12px;
            border: 2px solid #e0e0e0;
            border-radius: var(--border-radius);
            font-size: 0.9rem;
            transition: var(--transition);
        }

        .search-input:focus {
            outline: none;
            border-color: var(--primary-color);
        }

        .search-icon {
            position: absolute;
            right: 12px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-light);
        }

        #messageBox {
            margin-top: 20px;
            padding: 12px;
            border-radius: var(--border-radius);
            text-align: center;
            font-weight: 500;
            display: none;
        }

        .message-success {
            background-color: rgba(75, 181, 67, 0.1);
            color: var(--success-color);
            display: block;
        }

        .message-error {
            background-color: rgba(230, 57, 70, 0.1);
            color: var(--error-color);
            display: block;
        }

        .message-warning {
            background-color: rgba(255, 158, 0, 0.1);
            color: var(--warning-color);
            display: block;
        }

        .auto-save {
            font-size: 0.8rem;
            color: var(--success-color);
            opacity: 0;
            transition: var(--transition);
        }

        .auto-save.visible {
            opacity: 1;
        }

        .empty-state {
            text-align: center;
            color: var(--text-light);
            padding: 40px 20px;
        }

        .empty-state-icon {
            font-size: 3rem;
            margin-bottom: 15px;
            opacity: 0.5;
        }

        /* ALERTA DE IFRAME */
        .iframe-warning {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            background: var(--warning-color);
            color: black;
            padding: 12px;
            text-align: center;
            font-weight: 700;
            z-index: 1000;
            display: none;
        }

        .iframe-warning a {
            color: white;
            text-decoration: underline;
        }

/* UI NATIVO - Focus visible que funciona con TV y teclado */

/* Focus universal (TV usa esto cuando está en modo joystick) */
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.note-item:focus-visible,
[tabindex="0"]:focus-visible {
    outline: 3px solid #FFD700 !important;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.3);
    transform: scale(1.02);
    transition: all 0.15s ease;
}

/* Aumentar área click en TV (solo si es TV, no afecta desktop) */
@media (hover: none) and (pointer: coarse) {
    button, .toolbar-btn, .note-item {
        padding: 16px !important;
        min-height: 44px !important;
    }
}
/* Botón de Donación */
.toolbar-btn.donate {
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
    color: white;
    border: none;
    font-weight: bold;
}

.toolbar-btn.donate:hover {
    background: linear-gradient(45deg, #ff5252, #ff7b7b);
    transform: scale(1.05);
}

.toolbar-btn.donate:focus-visible {
    outline-color: #ff6b6b !important;
}
