/* Estilo general */
:root {
    --bg-color: #0a0a0a;
    --text-color: #e0e0e0;
    --accent-color: #d4af37;
    --accent-hover: #f9c846;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --font-main: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Prevent horizontal scroll from off-canvas menu */
}

/* Cursor Effect */
.cursor-glow {
    position: fixed;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: -1;
    transition: opacity 0.3s ease;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--accent-hover);
    text-decoration: none;
}

/* Header */
header {
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(10, 10, 10, 0.8);
    border-bottom: 1px solid var(--glass-border);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
}

.logo img {
    height: 40px;
    width: auto;
}

/* Main Layout */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    flex: 1;
    width: 100%;
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 60px;
    animation: fadeIn 1s ease-out;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    line-height: 1.2;
}

.text-gradient {
    background: linear-gradient(45deg, var(--accent-color), #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 1.2rem;
    color: #aaa;
    max-width: 600px;
    margin: 0 auto;
}

/* Grid Layout */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 60px;
}

/* Cards & Glassmorphism */
.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 30px;
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-color: var(--accent-color);
}

.card h2 {
    color: var(--accent-color);
    margin-bottom: 20px;
    font-size: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
}

.list-styled {
    list-style: none;
}

.list-styled li {
    margin-bottom: 15px;
    padding-left: 20px;
    position: relative;
}

.list-styled li::before {
    content: "•";
    color: var(--accent-color);
    position: absolute;
    left: 0;
    font-weight: bold;
}

.list-styled strong {
    color: #fff;
    display: block;
    margin-bottom: 5px;
}

.list-styled p {
    color: #ccc;
    font-size: 0.95rem;
}

/* Login Section */
.login-section {
    max-width: 500px;
    margin: 0 auto 60px;
    text-align: center;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    text-align: left;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(45deg, var(--accent-color), #b58900);
    color: #000;
}

.btn-primary:hover {
    transform: scale(1.02);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
}

.btn-secondary:hover {
    background: var(--accent-color);
    color: #000;
}

.help-text {
    text-align: center;
    color: #888;
    font-size: 0.9rem;
    margin-top: 40px;
}

/* Footer */
footer {
    background-color: #000;
    text-align: center;
    padding: 20px;
    margin-top: auto;
    border-top: 1px solid var(--glass-border);
}

footer p {
    color: #666;
    font-size: 0.85rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* Responsive */
@media (max-width: 968px) {
    .menu-toggle {
        display: flex;
    }

    /* Only target the header navigation for the off-canvas menu */
    header nav {
        position: fixed;
        top: 80px;
        right: -100%;
        width: 280px;
        height: calc(100vh - 80px);
        background: rgba(10, 10, 10, 0.98);
        backdrop-filter: blur(20px);
        border-left: 1px solid var(--glass-border);
        transition: right 0.3s ease;
        overflow-y: auto;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
        z-index: 1000;
        /* Ensure it is on top */
    }

    header nav.active {
        right: 0;
    }

    header nav ul {
        flex-direction: column;
        padding: 20px;
        gap: 0;
    }

    header nav li {
        width: 100%;
        border-bottom: 1px solid var(--glass-border);
    }

    header nav li:last-child {
        border-bottom: none;
    }

    header nav a {
        display: block;
        padding: 15px 10px;
        color: #fff;
        transition: all 0.3s ease;
    }

    header nav a:hover {
        background: rgba(212, 175, 55, 0.1);
        padding-left: 20px;
        color: var(--accent-color);
    }
}

/* Funeral Client Styles */
.funeral-client-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.funeral-client-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.familiar-item {
    background: rgba(255, 255, 255, 0.02);
    padding: 8px 12px;
    margin: 5px 0;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

@media (max-width: 768px) {
    .familiar-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .familiar-item>span {
        display: block;
        margin-bottom: 5px;
    }

    .familiar-item form,
    .familiar-item button {
        width: 100%;
        text-align: left;
    }

    .familiar-item button {
        padding: 8px;
        background: rgba(244, 67, 54, 0.1);
        border: 1px solid rgba(244, 67, 54, 0.2);
        border-radius: 4px;
    }
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    .main-container,
    .admin-container {
        padding: 20px 15px;
        /* Reducir padding */
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Fix Admin Dashboard Mobile */
    .glass-panel {
        padding: 15px;
        /* Reducir padding interno */
        overflow-x: hidden;
        /* Prevenir scroll horizontal */
    }

    .dashboard-header h1 {
        font-size: 2rem;
    }

    /* Force forms to stack */
    form .form-flex-mobile {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    /* Buttons full width on mobile */
    input[type="submit"],
    button {
        width: 100%;
        margin-top: 10px;
    }

    /* Funeral Client Header Fix */
    .funeral-client-header {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .funeral-client-header>div {
        width: 100%;
        margin-top: 10px;
        text-align: left;
    }

    .funeral-client-header .btn-group-mobile {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .funeral-client-header .btn-group-mobile form,
    .funeral-client-header .btn-group-mobile a {
        width: 100%;
    }

    .funeral-client-header .btn-group-mobile button {
        margin-top: 0;
    }

    /* Ensure inputs don't overflow */
    input,
    select,
    textarea {
        max-width: 100%;
    }
}

/* Chat Styles (Preserving existing chat styles but updating colors) */
.chat-container {
    background-color: #1e1e1e;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

/* ElevenLabs Widget Customization */
elevenlabs-convai {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

elevenlabs-convai::part(widget-button) {
    background-color: var(--accent-color);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
    transition: transform 0.3s ease;
}

elevenlabs-convai::part(widget-button):hover {
    transform: scale(1.1);
}

/* --- Admin & Dashboard Styles --- */

.admin-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 30px;
    backdrop-filter: blur(10px);
    margin-bottom: 30px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.glass-panel h2,
.glass-panel h3 {
    color: var(--accent-color);
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
}

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

label {
    display: block;
    margin-bottom: 8px;
    color: #ccc;
    font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: #fff;
    font-family: var(--font-main);
    font-size: 1rem;
    transition: all 0.3s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
    background: rgba(0, 0, 0, 0.5);
}

/* Grid Form Layout */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.form-grid-full {
    grid-column: 1 / -1;
}

/* Buttons */
.btn-action {
    display: inline-block;
    background: linear-gradient(45deg, var(--accent-color), #b58900);
    color: #000;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.3);
    color: #000;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: #ccc;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

input[type="submit"] {
    background: linear-gradient(45deg, var(--accent-color), #b58900);
    color: #000;
    font-weight: bold;
    cursor: pointer;
    border: none;
    margin-top: 20px;
    width: auto;
    min-width: 200px;
}

input[type="submit"]:hover {
    transform: scale(1.02);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iOS */
    max-width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    color: #e0e0e0;
    white-space: nowrap;
    /* Prevent wrapping in cells to keep table structure */
}

th,
td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

th {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--accent-color);
    font-weight: 600;
}

tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Dashboard Stats */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.stat-card h3 {
    font-size: 1rem;
    color: #aaa;
    margin-bottom: 10px;
}

.stat-card p {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-color);
    margin: 0;
}

/* Dashboard Actions */
.dashboard-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.action-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.action-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.05);
}

.action-card h3 {
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.action-card p {
    color: #aaa;
    font-size: 0.9rem;
    margin-bottom: 20px;
    flex-grow: 1;
}

/* Navigation List */
.nav-list ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.nav-list a {
    display: inline-block;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--accent-color);
    transition: all 0.3s ease;
}

.nav-list a:hover {
    background: var(--accent-color);
    color: #000;
}

/* Messages */
.message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.success-message {
    background: rgba(40, 167, 69, 0.2);
    border: 1px solid rgba(40, 167, 69, 0.4);
    color: #75b798;
}

.error-message {
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid rgba(220, 53, 69, 0.4);
    color: #ea868f;
}

/* ===== MENU COLAPSABLE ===== */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 200;
    /* Ensure it's above the glass header */
}

.menu-toggle span {
    display: block;
    width: 28px;
    height: 3px;
    background: var(--accent-color);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* ===== MEJORA DE BOTONES DEL CHAT ===== */
.chat-container {
    max-width: 900px;
    margin: 40px auto;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.chat-header {
    background: rgba(212, 175, 55, 0.1);
    border-bottom: 1px solid var(--glass-border);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h1 {
    color: var(--accent-color);
    font-size: 1.5rem;
    margin: 0;
}

.credit-info {
    color: #aaa;
    font-size: 0.9rem;
}

#messages {
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
    min-height: 300px;
}

.message {
    margin-bottom: 15px;
    padding: 15px;
    border-radius: 12px;
    line-height: 1.6;
}

.message.user {
    background: rgba(212, 175, 55, 0.1);
    border-left: 3px solid var(--accent-color);
}

.message.ai {
    background: rgba(76, 175, 80, 0.1);
    border-left: 3px solid #4caf50;
}

.message strong {
    color: var(--accent-color);
    display: block;
    margin-bottom: 8px;
}

.thinking {
    text-align: center;
    padding: 20px;
    color: var(--accent-color);
    font-style: italic;
    display: none;
}

.input-container {
    border-top: 1px solid var(--glass-border);
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
}

.input-container textarea {
    width: 100%;
    min-height: 80px;
    max-height: 200px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: #fff;
    font-family: var(--font-main);
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 15px;
}

.input-container textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

.input-container input[type="file"] {
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: #aaa;
    cursor: pointer;
}

.input-container input[type="file"]::-webkit-file-upload-button {
    background: var(--accent-color);
    color: #000;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    margin-right: 10px;
}

.input-container input[type="file"]::-webkit-file-upload-button:hover {
    background: var(--accent-hover);
}

/* Botones del Chat Mejorados */
.button-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.button-group button {
    flex: 1;
    min-width: 140px;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-main);
}

#send-btn {
    background: linear-gradient(135deg, var(--accent-color), #b58900);
    color: #000;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

#send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
}

#send-btn:active {
    transform: translateY(0);
}

#close-btn {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: #fff;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

#close-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.5);
}

#logout-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid var(--glass-border);
}

#logout-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.button-group button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.survey-link {
    text-align: center;
    margin-top: 15px;
}

.survey-link a {
    display: inline-block;
    padding: 10px 20px;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 8px;
    color: #4caf50;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.survey-link a:hover {
    background: rgba(76, 175, 80, 0.2);
    border-color: #4caf50;
    transform: translateY(-2px);
}

/* Responsive Chat */
@media (max-width: 768px) {
    .chat-container {
        margin: 20px 10px;
        border-radius: 12px;
    }

    .chat-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .button-group {
        flex-direction: column;
    }

    .button-group button {
        width: 100%;
        min-width: auto;
    }
}