/* === ESTILOS GENERALES === */
*, *::before, *::after {
    box-sizing: border-box;
}

body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background-color: #f4f7f6; color: #333; margin: 0; }
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.header { display: flex; justify-content: space-between; align-items: center; background-color: #fff; padding: 15px 30px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); margin-bottom: 25px; }
.header h1 { margin: 0; font-size: 24px; }
.header-link { text-decoration: none; color: #007bff; font-weight: 500; margin-left: 20px; }
.form-group { margin-bottom: 15px; }
label { display: block; margin-bottom: 5px; font-weight: 500; font-size: 14px; }
input[type="text"], input[type="password"], input[type="email"], input[type="number"], select, textarea { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; transition: border-color 0.2s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #007bff; }
button { background-color: #007bff; color: white; padding: 10px 15px; border: none; border-radius: 4px; cursor: pointer; font-size: 16px; transition: background-color 0.2s; }
button:hover { background-color: #0056b3; }

/* Styles for search input and button in configuracion.php */
.search-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px; /* Keep some margin below the search group */
}

.search-input-group input[type="text"] {
    flex-grow: 1;
    padding: 10px 15px;
    border-radius: 20px; /* More rounded */
    border: 1px solid #dcdcdc;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.search-input-group input[type="text"]:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.search-input-group button {
    flex-shrink: 0;
    padding: 10px 20px;
    border-radius: 20px; /* More rounded */
    background-color: #007bff; /* A bit different color */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.search-input-group button:hover {
    background-color: #0056b3;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

/* === ESTILOS PARA NOTIFICACIONES (SUCCESS/ERROR) === */
.success, .error {
    padding: 15px 20px;
    border-radius: 8px;
    margin: 0 auto 25px auto; /* Centrado y con margen inferior */
    max-width: 600px; /* Ancho reducido */
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    text-align: center;
    font-weight: 500;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.5s ease, transform 0.5s ease, visibility 0.5s ease;
    visibility: visible;
}

.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Clase para la animación de desaparición */
.fade-out {
    opacity: 0;
    transform: translateY(-20px);
    visibility: hidden;
}

pre { background-color: #eee; padding: 10px; border-radius: 4px; white-space: pre-wrap; word-wrap: break-word; }

/* === PÁGINA DE INICIO (VISOR) === */
.search-form { background-color: #fff; padding: 25px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.email-container { margin-top: 25px; padding: 25px; background-color: #fff; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.email-iframe { width: 100%; height: 600px; border: 1px solid #ccc; border-radius: 4px; }
.loader { border: 8px solid #f3f3f3; border-top: 8px solid #3498db; border-radius: 50%; width: 60px; height: 60px; animation: spin 1.5s linear infinite; margin: 40px auto; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* === PÁGINA DE CONFIGURACIÓN CON SIDEBAR === */
.main-layout { display: flex; height: 100vh; }
.sidebar {
    width: 260px;
    background-color: #1e293b; /* Darker blue-gray */
    color: #e2e8f0; /* Lighter text color */
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid #334155;
}
.sidebar-title {
    color: #fff;
    text-align: center;
    font-size: 22px;
    margin-bottom: 35px; /* Increased margin */
    font-weight: 600;
}
.sidebar-nav a, .sidebar-footer a {
    display: flex; /* Use flexbox for alignment */
    align-items: center;
    gap: 12px; /* Space between icon and text */
    color: #94a3b8; /* Muted text color */
    text-decoration: none;
    padding: 12px 15px;
    border-radius: 8px; /* Slightly more rounded */
    margin-bottom: 8px;
    transition: background-color 0.2s, color 0.2s;
}
.sidebar-nav a:hover, .sidebar-footer a:hover {
    background-color: #334155; /* Hover background */
    color: #fff;
}
.sidebar-nav a.active {
    background-color: #007bff;
    color: #fff;
    font-weight: 600; /* Bolder text for active link */
}
.sidebar-nav a.active svg, .sidebar-footer a.active svg {
    color: #fff; /* Ensure icon is also white on active */
}
.sidebar-nav a svg, .sidebar-footer a svg {
    flex-shrink: 0;
    color: #94a3b8; /* Default icon color */
    transition: color 0.2s;
}
.sidebar-nav a:hover svg, .sidebar-footer a:hover svg {
    color: #fff;
}
.sidebar-footer { margin-top: auto; border-top: 1px solid #334155; padding-top: 15px; }
.sidebar-footer a { font-size: 14px; margin-bottom: 5px; }
.main-content { flex-grow: 1; padding: 30px; overflow-y: auto; background-color: #f1f5f9; }
.content-header { margin-bottom: 20px; }
.content-header h2 { font-size: 28px; margin: 0 0 5px 0; }
.content-header p { font-size: 16px; color: #666; margin: 0; }

/* === ESTILOS PARA GESTIONAR CUENTAS === */
.accounts-layout { display: grid; grid-template-columns: 1fr 1.5fr; gap: 30px; align-items: flex-start; }
.add-account-card, .list-accounts-card { background-color: #fff; border-radius: 8px; padding: 25px; box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
.config-card h3 { margin-top: 0; font-size: 20px; border-bottom: 1px solid #eee; padding-bottom: 10px; margin-bottom: 15px; }
.account-list { max-height: 350px; overflow-y: auto; padding-right: 10px; }
.account-item { display: flex; justify-content: space-between; align-items: center; padding: 12px; border-radius: 6px; transition: background-color 0.2s; border-bottom: 1px solid #f0f0f0; }
.account-item:last-child { border-bottom: none; }
.account-item:hover { background-color: #f9f9f9; }
.account-info { display: flex; align-items: center; gap: 10px; }
.account-actions { display: flex; align-items: center; gap: 5px; } /* Added styles for side-by-side icons */
.provider-badge { background-color: #e9ecef; color: #495057; padding: 4px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; }
.account-email { font-weight: 500; color: #333; }
.empty-state { text-align: center; padding: 40px; color: #777; }
.empty-state p { font-size: 18px; margin-bottom: 5px; }

/* === ESTILOS PARA CATEGORÍAS === */
.config-card { background-color: #fff; padding: 25px 30px; border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
.config-card hr { border: 0; border-top: 1px solid #eee; margin: 20px 0; }
.edit-btn { background: none; border: none; color: #007bff; cursor: pointer; padding: 5px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.edit-btn:hover { background-color: #e6f2ff; } /* Light blue hover */
.delete-btn { background: none; border: none; color: #d9534f; cursor: pointer; padding: 5px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.delete-btn:hover { background-color: #f2dede; }
.category-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding-right: 0; /* Remove previous padding */
    max-height: none; /* Remove previous max-height */
    overflow-y: visible; /* Remove previous overflow */
}
.category-block {
    border: 1px solid #e9e9e9;
    border-radius: 6px;
    padding: 15px;
    margin-top: 0; /* Remove previous margin-top */
    display: flex; /* Use flexbox for internal layout */
    flex-direction: column;
    justify-content: space-between; /* Push footer to bottom */
}
.category-block + .category-block { /* Adjust margin for grid */
    margin-top: 0;
}
.category-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.category-header strong { font-size: 18px; }
.subject-list { list-style: none; padding: 0; margin: 0; }
.subject-list li { display: flex; justify-content: space-between; align-items: center; padding: 8px; border-radius: 4px; }
.subject-list li:nth-child(odd) { background-color: #f9f9f9; }
.delete-btn-small { background: none; border: none; color: #aaa; cursor: pointer; font-weight: bold; font-size: 16px; }
.delete-btn-small:hover { color: #d9534f; }
.add-subject-form { margin-top: 15px; display: flex; gap: 10px; }
.add-subject-form input { flex-grow: 1; }
.add-subject-form button { flex-shrink: 0; }

/* === ESTILOS PARA EL POPUP MODAL === */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); display: none; align-items: center; justify-content: center; z-index: 1000; opacity: 0; transition: opacity 0.3s ease; }
.modal-overlay.visible { display: flex; opacity: 1; }
.modal-content { background-color: #fff; padding: 30px; border-radius: 8px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); text-align: center; max-width: 400px; width: 90%; transform: scale(0.9); transition: transform 0.3s ease; }
.modal-overlay.visible .modal-content { transform: scale(1); }
.modal-content h3 { margin-top: 0; font-size: 22px; }
.modal-content p { margin: 15px 0; font-size: 16px; color: #555; }
.modal-buttons { margin-top: 25px; display: flex; justify-content: center; gap: 15px; }
.modal-buttons button { padding: 10px 20px; border-radius: 5px; font-weight: 500; }
.modal-buttons .btn-danger { background-color: #d9534f; }
.modal-buttons .btn-danger:hover { background-color: #c9302c; }
#modal-btn-cancel { background-color: #6c757d; }
#modal-btn-cancel:hover { background-color: #5a6268; }

/* === ESTILOS PARA ESTADÍSTICAS (Dashboard) === */
.stats-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.stat-card {
    background-color: #fff;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.stat-icon {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

/* === ESTILOS PARA CUENTA PRINCIPAL === */
.principal-badge {
    background-color: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
}

.btn-set-main {
    background-color: #17a2b8;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-set-main:hover {
    background-color: #138496;
}

.stat-card:nth-child(1) .stat-icon { background-color: #007bff; }
.stat-card:nth-child(2) .stat-icon { background-color: #28a745; }
.stat-card:nth-child(3) .stat-icon { background-color: #ffc107; }
.stat-card:nth-child(4) .stat-icon { background-color: #6f42c1; } /* Added color for the new card */

.stat-icon svg {
    width: 28px;
    height: 28px;
}

.stat-info h3 {
    margin: 0 0 5px 0;
    font-size: 18px;
    color: #333;
}

.stat-info .stat-number {
    font-size: 36px;
    font-weight: 600;
    color: #000;
    margin: 0;
}

.stat-info p {
    margin: 0;
    color: #666;
    font-size: 14px;
}
/* === ESTILOS PARA INDEX.PHP === */
.form-description { margin-bottom: 20px; color: #555; font-size: 15px; text-align: center; }
.search-form button { margin-top: 15px; width: auto; padding: 10px 25px; }
.search-form { display: flex; flex-wrap: wrap; gap: 15px; align-items: flex-end; }
.search-form .form-group { flex: 1; min-width: 250px; margin-bottom: 0; }
.search-form button { flex-shrink: 0; }
.loader p { text-align: center; margin-top: 10px; font-size: 16px; color: #555; }
.btn-secondary { background-color: #6c757d; margin-left: 10px; }
.btn-secondary:hover { background-color: #5a6268; }

/* === NUEVOS ESTILOS PARA EL VISOR (INDEX.PHP) === */
.index-body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    color: #444;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-image: url('img/fondo.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.viewer-container {
    width: 100%;
    max-width: 900px;
    margin: 30px auto;
    padding: 0 20px;
    flex-grow: 1;
    overflow-x: hidden; /* Prevent horizontal overflow */
}

.viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    margin-bottom: 30px;
}

.viewer-main {
    width: 100%;
}

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

.viewer-header .logo h1 {
    font-size: 26px;
    font-weight: 600;
    margin: 0;
    color: #ffffff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.viewer-header .logo svg {
    color: #ffffff;
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.5));
}

.admin-link {
    text-decoration: none;
    background-color: #e9ecef;
    color: #495057;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}

.admin-link:hover {
    background-color: #dce1e6;
    color: #212529;
}

.search-card {
    width: 100%; /* Ensure it takes full width of parent */
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
    transition: transform 0.4s ease, opacity 0.4s ease, box-shadow 0.4s ease;
}

.search-card.hidden {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
}

.search-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.card-logo {
    text-align: center;
    margin-bottom: 20px;
}

.card-logo img {
    max-width: 150px;
    height: auto;
}

.search-card h2 {
    margin: 0 0 10px 0;
    font-size: 22px;
    font-weight: 600;
    text-align: center;
}

.search-card .form-description {
    color: #666;
    margin-bottom: 25px;
    text-align: center;
    font-size: 15px;
}

#search-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

#search-form .form-group label {
    font-weight: 500;
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
}

#search-form select, #search-form input[type="email"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background-color: #f8f9fa;
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#search-form select:focus, #search-form input[type="email"]:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.form-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}

.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 15px;
    padding: 12px 22px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0069d9;
    transform: translateY(-1px);
}

.btn-primary:active,
.btn-secondary:active {
    transform: translateY(0) scale(0.98);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

#loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 15px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    width: 100%;
}

#loader .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

#loader p {
    font-size: 16px;
    color: #555;
    margin: 0;
}

.email-card {
    width: 100%; /* Ensure it takes full width of parent */
    background-color: rgba(255, 255, 255, 0.9); /* Match search-card background opacity */
    border-radius: 12px;
    padding: 30px; /* Match search-card padding */
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-top: 30px;
    margin-bottom: 30px; /* Add margin-bottom to match search-card */
    transition: transform 0.3s ease, box-shadow 0.3s ease; /* Added transition */
    border: 1px solid #e0e0e0; /* Added subtle border */
}

.email-card:hover { /* Added hover effect */
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.email-header {
    background-color: rgba(247, 247, 247, 0.9);
    padding: 0; /* Remove padding, it's now on .email-card */
    border-bottom: 1px solid #e9e9e9;
}

.email-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.email-details {
    padding: 20px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 20px;
}

.email-details div {
    flex: 1 1 250px;
    display: flex;
    flex-direction: column;
}

.email-details strong {
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 5px;
    font-weight: 500;
}

.email-body {
    margin-top: 20px;
    padding: 20px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

.email-body h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
}

.email-iframe {
    width: 100%;
    border: 1px solid #ced4da;
    border-radius: 8px;
    overflow-x: auto; /* Allow horizontal scrolling if content overflows */
    margin: 0;
    padding: 0;
}

.error-card {
    background-color: rgba(248, 215, 218, 0.9);
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.promo-footer {
    text-align: center;
    padding: 20px;
    background-color: rgba(44, 62, 80, 0.95);
    color: #ecf0f1;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.2);
    /* margin-top: 40px; */ /* Removed as flexbox handles spacing */
}

.promo-footer p {
    margin: 0;
    font-size: 17px;
    font-weight: 400;
}

.promo-footer a {
    display: inline-block;
    margin-left: 15px;
    background-color: #25D366;
    color: #ffffff;
    padding: 8px 18px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s, transform 0.2s;
}

.promo-footer a:hover {
    background-color: #1DAE54;
    transform: scale(1.05);
}

/* === EFECTOS Y ANIMACIONES === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

/* === ESTILOS PARA LOGIN === */

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    text-align: center;
}

.login-card h2 {
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 24px;
    font-weight: 600;
}

.login-card .form-group {
    text-align: left;
    margin-bottom: 20px;
}

.login-card .form-group label {
    font-weight: 500;
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
}

.login-card input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background-color: #f8f9fa;
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-card input:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.login-card .btn-primary {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
}

.login-card .error {
    text-align: center;
    margin-bottom: 20px;
}

.image-preview {
    margin-top: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.image-preview p {
    margin: 0 0 10px 0;
    font-weight: 500;
    font-size: 14px;
}

.image-preview img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* === ESTILOS PARA PÁGINA DE DISEÑO === */
.design-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: flex-start;
}

.design-layout .config-card {
    margin-bottom: 0;
}

.design-layout .image-preview img {
    max-width: 200px;
    border: 1px solid #ddd;
    padding: 5px;
    border-radius: 4px;
    margin-top: 10px;
}

/* === ESTILOS PARA LA TABLA DE REGISTROS === */
.logs-table-container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    overflow: hidden;
}

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

.logs-table th, .logs-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e9e9e9;
}

.logs-table thead {
    background-color: #f7f7f7;
}

.logs-table th {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.logs-table tbody tr:hover {
    background-color: #f9f9f9;
}

.status-success {
    background-color: #d4edda;
    color: #155724;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
}

.status-error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
}

/* === ESTILOS PARA EL BANNER DE COOKIES === */
.cookie-banner-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.cookie-banner {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    text-align: center;
    max-width: 450px;
    width: 90%;
}

.cookie-banner p {
    margin: 0 0 20px 0;
    font-size: 16px;
    color: #333;
}

.cookie-banner button {
    padding: 10px 25px;
}

/* === ESTILOS PARA ACTIVAR/DESACTIVAR CATEGORÍAS === */
.category-block.is-inactive {
    background-color: #f9f9f9;
    opacity: 0.7;
}

.category-block.is-inactive .category-header strong {
    text-decoration: line-through;
}

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

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

.category-actions {
    display: flex;
    align-items: center;
}

.status-badge {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 12px;
    color: #fff;
}

.is-active .status-badge {
    background-color: #28a745;
}

.is-inactive .status-badge {
    background-color: #6c757d;
}

.btn-toggle-status {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 5px;
    cursor: pointer;
    border: 1px solid;
}

.is-active .btn-toggle-status {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #212529;
}
.is-active .btn-toggle-status:hover {
    background-color: #e0a800;
}

.is-inactive .btn-toggle-status {
    background-color: #28a745;
    border-color: #28a745;
    color: #fff;
}
.is-inactive .btn-toggle-status:hover {
    background-color: #218838;
}

/* === ESTILOS PARA EDICIÓN DE CATEGORÍAS === */
.edit-category-form {
    display: flex;
    gap: 5px;
    align-items: center;
}

.edit-category-input {
    padding: 5px 8px;
    font-size: 16px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.btn-save-edit {
    background-color: #28a745;
    color: white;
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 500;
}

.btn-save-edit:hover {
    background-color: #218838;
}

.btn-edit-category, .btn-cancel-edit {
    background-color: #007bff;
    color: white;
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    margin-right: 8px;
}

.btn-edit-category:hover, .btn-cancel-edit:hover {
    background-color: #0056b3;
}

.btn-cancel-edit {
    background-color: #6c757d;
}

.btn-cancel-edit:hover {
    background-color: #5a6268;
}

/* === ESTILOS PARA LA PÁGINA DE SEO === */
.form-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap; /* Allow wrapping for small screens */
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.form-group-toggle .toggle-label {
    margin-bottom: 0;
    font-weight: 600;
    color: #343a40;
    flex-grow: 1;
}

.form-group-toggle small {
    flex-basis: 100%;
    margin-top: 10px;
    color: #6c757d;
    font-size: 13px;
}

/* Estilos para el interruptor (toggle switch) */
.switch {
    position: relative;
    display: inline-block;
    width: 56px; /* Slightly smaller */
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input:checked + .slider {
    background-color: #28a745; /* Verde para 'activado' */
}

input:focus + .slider {
    box-shadow: 0 0 1px #28a745;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Rounded sliders */
.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

#meta_description {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
}

.form-group small {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: #6c757d;
}

/* === ESTILOS PARA LA PÁGINA DE SEO (COMPACTO) === */
.view-seo .config-card,
.view-seo .form-actions {
    max-width: 800px; /* Ancho máximo para el contenido de SEO */
    margin-left: auto;
    margin-right: auto;
}

.view-seo .form-actions {
    padding-right: 0; /* Resetea cualquier padding que pueda afectar la alineación */
}

/* === ESTILOS PARA PESTAÑAS (TABS) === */
.tabs-container {
    width: 100%;
}

.tab-buttons {
    display: flex;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 20px;
}

.tab-button {
    padding: 12px 20px;
    cursor: pointer;
    border: none;
    background-color: transparent;
    font-size: 16px;
    font-weight: 500;
    color: #495057;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px; /* Align with the container's border */
    transition: color 0.2s, border-color 0.2s;
}

.tab-button:hover {
    color: white;
}

.tab-button.active {
    color: #007bff;
    border-color: #007bff;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.5s;
}

.account-item.is-inactive {
    background-color: #f8f9fa;
    opacity: 0.6;
}

.account-item.is-inactive .account-email {
    text-decoration: line-through;
}

/* === ESTILOS PARA EL BOTÓN DE SIDEBAR MÓVIL === */
.sidebar-toggle-btn {
    display: none; /* Oculto por defecto */
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1010; /* Por encima de todo */
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    cursor: pointer;
    color: #333;
    transition: background-color 0.2s;
}
.sidebar-toggle-btn:hover {
    background-color: #fff;
}

/* === ESTILOS RESPONSIVE (MÓVIL) === */
@media (max-width: 768px) {
    /* Adjustments for index.php */
    .viewer-container {
        margin: 15px auto;
        padding: 0 15px;
    }

    .viewer-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .viewer-header .logo h1 {
        font-size: 22px; /* Slightly smaller title */
    }

    .search-card {
        padding: 20px;
    }

    #search-form .form-row {
        grid-template-columns: 1fr; /* Stack form fields */
        gap: 20px;
    }
    
    .form-actions {
        flex-direction: column; /* Stack buttons */
    }
    
    .form-actions button {
        width: 100%;
        margin-left: 0; /* Reset margin for secondary button */
    }

    .email-details {
        grid-template-columns: 1fr; /* Stack email details */
    }

    .promo-footer p {
        font-size: 16px;
    }

    .promo-footer a {
        display: block;
        margin-top: 15px;
        margin-left: 0;
    }

    /* --- Adjustments for Admin Panel (Mobile Toggle Sidebar) --- */
    .sidebar-toggle-btn {
        display: flex; /* Mostrar en móvil */
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        border-right: 1px solid #334155;
    }

    .main-layout.sidebar-open .sidebar {
        transform: translateX(0);
        box-shadow: 0 0 20px rgba(0,0,0,0.3);
    }

    .main-content {
        padding: 15px;
        padding-top: 60px; /* Espacio para el botón fijo */
        width: 100%;
    }
    
    /* Stack all grid layouts */
    .design-layout,
    .stats-layout,
    .filter-grid,
    .category-list {
        grid-template-columns: 1fr;
    }

    /* Use block display for simpler stacking on these layouts */
    .accounts-layout {
        display: block;
    }

    .add-account-card {
        margin-bottom: 25px; /* Add space between the two cards */
    }

    .account-item,
    .category-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .account-actions,
    .category-actions {
        width: 100%;
        justify-content: flex-start;
        margin-top: 10px;
    }

    .config-card {
        padding: 20px;
    }

    .filter-actions {
        flex-direction: column;
        gap: 15px;
    }

    .filter-actions .btn-secondary {
        margin-left: 0;
    }

    .tab-buttons {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .logs-table-container {
        overflow-x: auto;
    }

    .logs-table {
        min-width: 600px;
    }
}
