/* ========== VARIABLES COMPARTIDAS ========== */
:root {
    /* Brand Colors */
    --primary-color: rgb(35, 25, 48);
    --secondary-color: #28149b;
    --accent-color: #cf860f;

    /* UI Colors */
    --bg-gradient-start: #f8f9fa;
    --bg-gradient-end: #e9ecef;
    --card-bg: #ffffff;
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #6c757d;

    /* Button Colors */
    --btn-primary: var(--primary-color);
    --btn-hover: #cf860f;
    --btn-active: #190F26;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.1);
    --shadow-inset: inset 0 2px 4px rgba(0, 0, 0, 0.05);

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ========== BASE STYLES ========== */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    font-family: 'Poppins', 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    background-attachment: fixed;
}

.page-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.content-wrapper {
    flex: 1;
    padding: var(--spacing-lg) 0;
    position: relative;
}

/* Add a subtle pattern overlay */
.content-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23a53053' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
    z-index: -1;
}

/* ========== TYPOGRAPHY ========== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    /* color: var(--primary-color); */
    margin-bottom: var(--spacing-md);
}

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

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

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

/* ========== SWEETALERT CUSTOMIZATION ========== */
.swal2-popup {
    border-radius: var(--radius-lg) !important;
    padding: 2em !important;
}

.swal2-title {
    color: var(--primary-color) !important;
}

.swal2-confirm {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)) !important;
    border-radius: var(--radius-md) !important;
}

/* ========== UTILITIES ========== */
.cursor-pointer {
    cursor: pointer;
}

.shadow-hover {
    transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.shadow-hover:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
}

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(107, 1, 51, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

#loading-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* ========== DASHBOARD STYLES ========== */
/* Dashboard Container and Typography */
.dashboard-container {
    max-width: 1300px;
    /* Aumentado de 1200px para hacer las cards más anchas */
    margin: 0 auto;
    padding: var(--spacing-md);
}

.dashboard-title {
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
    position: relative;
    padding-bottom: 10px;
}

.dashboard-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

.dashboard-subtitle {
    color: var(--primary-color);
    font-weight: 600;
    text-align: center;
    margin-bottom: 1.5rem;
}

/* Accordion Styling */
.accordion {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.accordion-item {
    border: none;
    margin-bottom: 2px;
}

.accordion-item:last-child {
    margin-bottom: 0;
}

.accordion-header {
    border-radius: 8px;
    overflow: hidden;
}

.accordion-button {
    padding: 1.25rem 1.5rem;
    background-color: white;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 1.05rem;
    /* Ligeramente más grande */
}

.accordion-button:not(.collapsed) {
    background-color: rgba(107, 1, 51, 0.05);
    color: var(--primary-color);
    box-shadow: none;
}

.accordion-button:focus {
    box-shadow: 0 0 0 0.25rem rgba(107, 1, 51, 0.25);
    border-color: transparent;
}

.accordion-button::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%236B0133'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
    transition: all 0.3s ease;
}

.accordion-button.collapsed::after {
    transform: rotate(-90deg);
}

.accordion-body {
    padding: 1.5rem;
    background-color: white;
}

/* Badge Styling */
.badge {
    padding: 0.4em 0.7em;
    font-size: 0.8em;
    font-weight: 600;
    border-radius: 50rem;
    background-color: var(--primary-color);
    color: white;
}

/* QR Code Generator Form */
.qr-generator-form {
    background: white;
    border-radius: 8px;
    padding: 2.5rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.qr-generator-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.form-label {
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.5rem;
}

.form-control {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 0.25rem rgba(165, 48, 83, 0.25);
}

.input-group {
    position: relative;
}

.input-group-text {
    background-color: white;
    border-color: #dee2e6;
}

/* Search Box */
.search-box {
    margin-bottom: 1.5rem;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    width: 100%;
    /* Asegurar que ocupe todo el ancho disponible */
}

.table {
    margin-bottom: 0;
    width: 100%;
}

.table thead th {
    background-color: rgba(107, 1, 51, 0.9);
    color: white;
    padding: 1rem;
    font-weight: 600;
    border-bottom: none;
    vertical-align: middle;
}

.table tbody tr {
    transition: background-color 0.15s ease-in-out;
}

.table-hover tbody tr:hover {
    background-color: rgba(165, 48, 83, 0.05);
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

.table td {
    padding: 1rem;
    vertical-align: middle;
    border-top: 1px solid #dee2e6;
}

/* QR Code styling in table */
.qr-code-cell {
    cursor: pointer;
    padding: 15px !important;
    text-align: center;
    transition: all 0.3s ease;
}

.qr-code-cell:hover {
    transform: scale(1.05);
}

.qr-code-cell svg {
    width: 100px;
    height: 100px;
}

/* URL truncation and copy styling */
.truncate-url {
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    font-size: 1.05rem;
}

.copy-url {
    cursor: pointer;
    transition: color 0.3s ease;
    color: var(--primary-color);
}

.copy-url:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Button Styling */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--btn-hover);
    border-color: var(--btn-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

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

/* Modal Styling */
.modal-header {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-bottom: none;
}

.modal-title {
    font-weight: 600;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    padding: 1rem;
}

.btn-success {
    background-color: #198754;
    border-color: #198754;
    transition: all 0.3s ease;
}

.btn-success:hover {
    background-color: #157347;
    border-color: #146c43;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background-color: #bb2d3b;
    border-color: #b02a37;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-warning {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #212529;
    transition: all 0.3s ease;
}

.btn-warning:hover {
    background-color: #ffca2c;
    border-color: #ffc720;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Action Buttons */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.95rem;
    border-radius: 0.2rem;
}

.btn-icon {
    width: 36px;
    /* Aumentado de 32px */
    height: 36px;
    /* Aumentado de 32px */
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

/* No Results */
.no-results {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

/* ========== RESPONSIVE STYLES ========== */
@media (max-width: 992px) {
    .dashboard-container {
        max-width: 100%;
        padding: var(--spacing-md);
    }

    .truncate-url {
        max-width: 250px;
    }
}

@media (max-width: 768px) {
    .qr-generator-form {
        padding: 1.5rem;
    }

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

    .truncate-url {
        max-width: 200px;
    }

    .qr-code-cell svg {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 576px) {
    .dashboard-title {
        font-size: 1.5rem;
    }

    .qr-generator-form {
        padding: 1.25rem;
    }

    .accordion-button {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .truncate-url {
        max-width: 150px;
    }

    .qr-code-cell svg {
        width: 70px;
        height: 70px;
    }
}

#generate-form,
#qr-list {
    width: 100%;
    max-width: 55%;
    margin: 0 auto;
}

/* Para tablets */
@media (max-width: 768px) {

    #generate-form,
    #qr-list {
        max-width: 90%;
    }
}

/* Para móviles */
@media (max-width: 576px) {

    #generate-form,
    #qr-list {
        max-width: 100%;
        padding: 0 1rem;
        /* Opcional: agrega un poco de espacio a los lados */
    }
}
