:root {
    --netflix-red: #E50914;
    --netflix-black: #000000;
    --netflix-dark: #141414;
    --netflix-gray: #808080;
    --netflix-light: #FFFFFF;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--netflix-black);
    color: var(--netflix-light);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header Minimalista */
.header {
    background: var(--netflix-black);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo i {
    font-size: 28px;
    color: var(--netflix-red);
}

.logo h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--netflix-red);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--netflix-gray);
    animation: pulse 2s ease-in-out infinite;
}

.status-indicator.connected .status-dot {
    background: #10B981;
}

.status-indicator.monitoring .status-dot {
    background: var(--netflix-red);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(0.9);
    }
}

.status-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--netflix-gray);
}

/* Main Content */
.main-content {
    padding: 40px 0;
}

/* Stats Grid - Minimalista */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    transition: var(--transition);
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--netflix-red);
    transform: translateY(-2px);
}

.stat-info h3 {
    font-size: 36px;
    font-weight: 700;
    color: var(--netflix-red);
    margin-bottom: 4px;
}

.stat-info p {
    font-size: 13px;
    color: var(--netflix-gray);
    font-weight: 500;
}

/* Controls Section - Minimalista */
.controls-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.controls-left,
.controls-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Buttons Minimalistas */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

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

.btn-primary:hover {
    background: #f40612;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--netflix-light);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

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

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

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--netflix-light);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--netflix-red);
}

/* Filter Group */
.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 13px;
    color: var(--netflix-gray);
    font-weight: 500;
}

.filter-select {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--netflix-light);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.filter-select:hover {
    border-color: var(--netflix-red);
}

.filter-select:focus {
    outline: none;
    border-color: var(--netflix-red);
}

/* Emails Section */
.emails-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.section-header h2 {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--netflix-light);
}

.section-header i {
    color: var(--netflix-red);
}

.update-time {
    font-size: 12px;
    color: var(--netflix-gray);
}

.emails-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

/* Email Card - Minimalista con animación */
.email-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 3px solid var(--type-color);
    border-radius: 6px;
    padding: 20px;
    transition: var(--transition);
    opacity: 0;
    transform: translateY(20px);
    animation: slideIn 0.4s ease-out forwards;
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.email-card.type-codigo_inicio {
    --type-color: var(--netflix-red);
}

.email-card.type-codigo_temporal {
    --type-color: #F59E0B;
}

.email-card.type-actualizacion_hogar {
    --type-color: #3B82F6;
}

.email-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-left-width: 4px;
    transform: translateY(-4px);
}

.email-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.email-subject {
    font-size: 15px;
    font-weight: 600;
    color: var(--netflix-light);
    margin-bottom: 8px;
}

.email-type-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    background: rgba(229, 9, 20, 0.2);
    color: var(--type-color);
    border: 1px solid var(--type-color);
}

.email-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    color: var(--netflix-gray);
    margin-bottom: 12px;
}

.email-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
    word-break: break-all;
    /* Permitir que los emails largos se ajusten */
}

.email-meta i {
    color: var(--netflix-red);
    width: 14px;
}

/* Código destacado */
.email-code {
    background: rgba(229, 9, 20, 0.05);
    /* Fondo más sutil */
    border: 1px solid rgba(229, 9, 20, 0.2);
    border-radius: 6px;
    padding: 16px;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    /* Cambiado a columna para mejor layout de botones */
    gap: 12px;
    animation: glow 2s ease-in-out infinite;
}

.email-code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(229, 9, 20, 0.3);
    }

    50% {
        box-shadow: 0 0 20px rgba(229, 9, 20, 0.5);
    }
}

.code-label {
    font-size: 11px;
    color: var(--netflix-gray);
    font-weight: 500;
    margin-bottom: 4px;
}

.code-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--netflix-red);
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

.email-preview {
    display: none;
    /* Ocultar preview en modo grid para máxima limpieza */
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 64px;
    color: var(--netflix-gray);
    opacity: 0.3;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--netflix-light);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--netflix-gray);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--netflix-dark);
    border-radius: 8px;
    max-width: 600px;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideUp 0.3s ease-out;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-content.large {
    max-width: 900px;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-header i {
    color: var(--netflix-red);
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--netflix-gray);
    cursor: pointer;
    font-size: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--netflix-light);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.email-content-viewer {
    background: white;
    color: black;
    border-radius: 4px;
    padding: 20px;
    min-height: 300px;
    overflow-x: auto;
}

.email-content-viewer.dark-mode {
    background: #1a1a1a;
    color: #e5e5e5;
}

.modal-footer {
    padding: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--netflix-light);
    margin-bottom: 8px;
}

.form-group small {
    display: block;
    font-size: 12px;
    color: var(--netflix-gray);
    margin-top: 4px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--netflix-light);
    font-size: 14px;
    transition: var(--transition);
    font-family: inherit;
}

.form-input:hover {
    border-color: var(--netflix-red);
}

.form-input:focus {
    outline: none;
    border-color: var(--netflix-red);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-label span {
    font-size: 14px;
    color: var(--netflix-light);
    font-weight: 500;
}

/* Accounts Info */
.accounts-info {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.accounts-info h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--netflix-light);
    margin-bottom: 12px;
}

.accounts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.account-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.account-item i {
    color: var(--netflix-red);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--netflix-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 4px solid var(--toast-color);
    border-radius: 4px;
    padding: 16px;
    min-width: 300px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    --toast-color: #10B981;
}

.toast.error {
    --toast-color: #dc2626;
}

.toast.warning {
    --toast-color: #F59E0B;
}

.toast.info {
    --toast-color: var(--netflix-red);
}

.toast-icon {
    font-size: 20px;
    color: var(--toast-color);
}

.toast-message {
    flex: 1;
    font-size: 14px;
    color: var(--netflix-light);
}

/* Loading spinner */
.loading {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .controls-section {
        flex-direction: column;
        align-items: stretch;
    }

    .controls-left,
    .controls-right {
        width: 100%;
        flex-direction: column;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    .filter-select {
        width: 100%;
    }

    .email-header {
        flex-direction: column;
        gap: 12px;
    }

    .code-value {
        font-size: 20px;
        letter-spacing: 4px;
    }
}