/* Modern Digital Signage Admin UI - ForgeNEX Redesign */

/* Import Google Font: Poppins */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    /* ForgeNEX Color Palette */
    --primary-color: #c52828; /* ForgeNEX Red */
    --primary-dark: #a12020; /* Darker Red for Hover */
    --background-primary: #00132f; /* ForgeNEX Dark Blue */
    --background-secondary: #001a40; /* Slightly Lighter Blue */
    --background-tertiary: #012152; /* Even Lighter Blue */
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --text-light: #b0b0b0;
    --border-color: #012b69;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;

    /* UI Styles */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.08);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

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

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background-primary);
    min-height: 100vh;
    font-weight: 400;
}

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

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 2rem;
    background: var(--background-secondary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    flex-wrap: wrap; /* Allow wrapping */
    gap: 1.5rem; /* Add gap between title and actions when wrapped */
}

.header h1 {
    color: var(--text-primary);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0; /* Remove bottom margin to let gap handle spacing */
    line-height: 1.2;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap; /* Allow buttons to wrap */
}

/* Modern Buttons (ForgeNEX Style) */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center; /* Ensure text is centered */
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--background-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--background-primary);
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    background-color: #555;
}

.btn .material-icons {
    font-size: 1.125rem;
    margin-right: 0.5rem;
}

/* Modern Forms (ForgeNEX Style) */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: var(--background-secondary);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(197, 40, 40, 0.2);
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--background-primary);
    padding: 1rem;
}

.login-form {
    background: var(--background-secondary);
    padding: 3rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border-color);
}

.login-form h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 2rem;
}

.error-message {
    background-color: var(--error-color);
    color: white;
    padding: 10px;
    border-radius: var(--radius-md);
    margin-top: 15px;
    text-align: center;
}


/* Display Cards */
.displays-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.display-card {
    background: var(--background-secondary);
    padding: 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column; /* Ensure content flows vertically */
}

.display-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-color);
}

.display-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

.display-card h3 {
    margin-bottom: 0.75rem;
    color: var(--primary-color);
    font-size: 1.25rem;
    font-weight: 600;
}

.display-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    flex-grow: 1; /* Allows text to take up available space, pushing actions down */
}

.display-date {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
}

.display-devices {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

.display-devices.empty {
    opacity: 0.5;
}

.device-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: #333;
    color: #888;
    font-size: 0.7rem;
    border-radius: 4px;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid #444;
}

.device-badge.active {
    background: rgba(39, 174, 96, 0.2);
    color: #2ecc71;
    border-color: #27ae60;
}

.display-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap; /* <<< CORRECCIÓN CLAVE: Permite que los botones salten de línea */
}

.display-actions .btn {
    flex-grow: 1; /* Allows buttons to grow and fill space */
    flex-basis: calc(50% - 0.5rem); /* Set base width for 2 buttons per row */
    min-width: 120px; /* Ensure buttons don't get too small */
}

/* Configuration Layout */
.config-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 2rem;
    height: calc(100vh - 180px);
}

.config-sidebar, .config-main {
    background: var(--background-secondary);
    padding: 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    overflow-y: auto;
}

.config-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.config-section:last-child {
    border-bottom: none;
}

.config-section h3 {
    margin-bottom: 1.25rem;
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 600;
}

/* Grid Preview */
.grid-preview {
    display: grid;
    gap: 1rem;
    height: 100%;
    min-height: 500px;
    padding: 1rem;
    background-color: var(--background-primary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.zone {
    background: var(--background-secondary);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-light);
    position: relative;
    overflow: hidden;
}

.zone:hover {
    border-color: var(--primary-color);
    background: var(--background-tertiary);
}

.zone.configured {
    border-style: solid;
    border-color: var(--success-color);
}

.zone-preview-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.75rem;
    gap: 0.25rem;
    width: 100%;
    height: 100%;
}

.zone-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--background-tertiary);
    margin-bottom: 0.25rem;
}

.zone-icon i {
    font-size: 1.5rem;
    color: var(--text-light);
}

.zone.configured .zone-icon {
    background: rgba(16, 185, 129, 0.15);
}

.zone.configured .zone-icon i {
    color: var(--success-color);
}

.zone-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.zone.configured .zone-label {
    color: var(--text-primary);
}

.zone-type-badge {
    background: var(--success-color);
    color: white;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.zone-info {
    font-size: 0.7rem;
    color: var(--text-light);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 0.25rem;
}

.zone-empty-hint {
    font-size: 0.7rem;
    color: var(--text-light);
    opacity: 0.7;
}

.zone:hover .zone-empty-hint {
    color: var(--primary-color);
    opacity: 1;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 19, 47, 0.8);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--background-secondary);
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 520px;
    border: 1px solid var(--border-color);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-color);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-content h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 700;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-light);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

.config-sidebar::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
}

.config-sidebar::-webkit-scrollbar-thumb:hover,
.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ===========================================
   RESPONSIVE STYLES
   =========================================== */

/* Tablet and below */
@media (max-width: 1024px) {
    .container {
        padding: 1rem;
    }

    .config-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .config-sidebar {
        order: 1;
    }

    .config-main {
        order: 2;
        min-height: 400px;
    }

    .header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .header h1 {
        font-size: 1.75rem;
    }

    .header-actions {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .container {
        padding: 0.75rem;
    }

    .header {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions .btn {
        flex: 1;
        min-width: 120px;
        padding: 0.6rem 0.8rem;
        font-size: 0.75rem;
    }

    /* Buttons */
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }

    /* Display cards */
    .displays-grid {
        grid-template-columns: 1fr;
    }

    .display-card {
        padding: 1.25rem;
    }

    .display-actions .btn {
        flex-basis: 100%;
        min-width: unset;
    }

    /* Forms */
    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Modal */
    .modal-content {
        width: 95%;
        padding: 1.5rem;
        max-height: 85vh;
    }

    .modal-content.large {
        width: 95%;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions .btn {
        width: 100%;
    }

    /* Config sections */
    .config-section {
        padding-bottom: 1rem;
        margin-bottom: 1rem;
    }

    /* Tables - hide on mobile, show cards instead */
    .table-responsive-cards thead {
        display: none;
    }

    .table-responsive-cards tbody tr {
        display: block;
        margin-bottom: 1rem;
        padding: 1rem;
        background: var(--background-secondary);
        border-radius: var(--radius-lg);
        border: 1px solid var(--border-color);
    }

    .table-responsive-cards tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border: none;
        border-bottom: 1px solid var(--border-color);
    }

    .table-responsive-cards tbody td:last-child {
        border-bottom: none;
    }

    .table-responsive-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-light);
        font-size: 0.8rem;
        text-transform: uppercase;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .header h1 {
        font-size: 1.2rem;
    }

    .header-actions .btn {
        font-size: 0.7rem;
        padding: 0.5rem 0.6rem;
    }

    .btn .material-icons {
        font-size: 1rem;
        margin-right: 0.25rem;
    }

    .display-card h3 {
        font-size: 1.1rem;
    }
}

/* ==================== MEDIA MANAGER STYLES ==================== */

.upload-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--background-tertiary);
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--primary-color);
    background: rgba(197, 40, 40, 0.1);
}

.upload-dropzone p {
    margin: 10px 0 5px;
    color: var(--text-secondary);
}

.upload-dropzone small {
    color: var(--text-light);
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--background-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.3s ease;
}

.media-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    padding: 5px;
}

.media-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--background-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.media-file-item:hover {
    border-color: var(--primary-color);
}

.media-file-item.selectable {
    cursor: pointer;
}

.media-file-item.selectable:hover {
    background: rgba(197, 40, 40, 0.1);
}

.media-thumbnail {
    width: 50px;
    height: 50px;
    min-width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background-primary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.media-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-thumbnail i {
    font-size: 24px;
    color: var(--text-light);
}

.media-info {
    flex-grow: 1;
    min-width: 0;
    overflow: hidden;
}

.media-name {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-meta {
    font-size: 0.75rem;
    color: var(--text-light);
}

.media-actions {
    display: flex;
    gap: 5px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--background-primary);
    color: var(--text-primary);
}

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

.files-filter {
    display: flex;
    gap: 5px;
}

.filter-btn,
.picker-filter-btn {
    padding: 5px 15px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.filter-btn:hover,
.picker-filter-btn:hover {
    border-color: var(--primary-color);
}

.filter-btn.active,
.picker-filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
}

/* ==================== RADIO & CHECKBOX GROUPS ==================== */

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.radio-group label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    background: var(--background-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    margin: 0;
}

.radio-group label:hover {
    border-color: var(--primary-color);
    background: rgba(197, 40, 40, 0.1);
}

.radio-group label:has(input:checked) {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.radio-group input[type="radio"] {
    width: auto;
    margin: 0;
    accent-color: white;
}

/* Checkbox toggle style */
.checkbox-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--background-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.checkbox-toggle:hover {
    border-color: var(--primary-color);
}

.checkbox-toggle:has(input:checked) {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

.checkbox-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--success-color);
    cursor: pointer;
}

.checkbox-toggle .toggle-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.checkbox-toggle .toggle-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

/* Help text styling */
.help-text {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    line-height: 1.4;
}

.help-text.warning {
    color: var(--warning-color);
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(245, 158, 11, 0.1);
    border-radius: var(--radius-sm);
}

.help-text.warning i {
    font-size: 1rem;
    flex-shrink: 0;
}

/* ==================== TEXT STYLE CONTROLS ==================== */

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 120px;
}

.color-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.color-input-row input[type="color"] {
    width: 50px;
    height: 36px;
    padding: 2px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.color-hex-input {
    width: 80px !important;
    font-family: monospace;
    text-transform: uppercase;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-inline input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.subsection {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--background-tertiary);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--primary-color);
}

.subsection .form-row {
    margin-bottom: 0.5rem;
}

.subsection .form-row:last-child {
    margin-bottom: 0;
}

.subsection .form-group {
    margin-bottom: 0;
}

.subsection label {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.subsection input[type="range"] {
    width: 100%;
    height: 6px;
    margin: 0.25rem 0;
}

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

/* Text Style Preview */
.text-style-preview {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    overflow: hidden;
    position: relative;
}

.text-style-preview .preview-text {
    padding: 1rem;
    transition: all 0.3s ease;
    white-space: nowrap;
}

/* Preview Animations */
.text-style-preview.animate-fadeIn .preview-text {
    animation: previewFadeIn 1s ease forwards;
}

.text-style-preview.animate-pulse .preview-text {
    animation: previewPulse 2s ease-in-out infinite;
}

.text-style-preview.animate-glow .preview-text {
    animation: previewGlow 2s ease-in-out infinite;
}

.text-style-preview.animate-bounce .preview-text {
    animation: previewBounce 1s ease infinite;
}

.text-style-preview.animate-marqueeLeft .preview-text {
    animation: previewMarqueeLeft 5s linear infinite;
}

.text-style-preview.animate-slideInLeft .preview-text {
    animation: previewSlideInLeft 1s ease forwards;
}

.text-style-preview.animate-zoomIn .preview-text {
    animation: previewZoomIn 1s ease forwards;
}

@keyframes previewFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes previewPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

@keyframes previewGlow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.3); }
}

@keyframes previewBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes previewMarqueeLeft {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

@keyframes previewSlideInLeft {
    from { transform: translateX(-50px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes previewZoomIn {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ==================== PLAYLIST MANAGER ==================== */

.slideshow-duration-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: var(--background-tertiary);
    border-radius: var(--radius-md);
}

.slideshow-duration-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    white-space: nowrap;
}

.duration-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.duration-input input {
    width: 70px;
    padding: 0.4rem 0.5rem;
    font-size: 0.9rem;
    text-align: center;
}

.duration-input span {
    font-size: 0.8rem;
    color: var(--text-light);
}

.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.playlist-count {
    font-size: 0.8rem;
    color: var(--text-light);
}

.playlist-actions {
    display: flex;
    gap: 0.5rem;
}

.playlist-items {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--background-primary);
}

.playlist-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-light);
}

.playlist-empty i {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.playlist-empty p {
    margin: 0;
    font-size: 0.85rem;
}

.playlist-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--background-secondary);
    transition: background 0.2s ease;
}

.playlist-item:last-child {
    border-bottom: none;
}

.playlist-item:hover {
    background: var(--background-tertiary);
}

.playlist-item.disabled {
    opacity: 0.5;
}

.playlist-item.disabled .playlist-item-info {
    text-decoration: line-through;
}

.playlist-item-drag {
    cursor: grab;
    color: var(--text-light);
    padding: 0.25rem;
    display: flex;
    align-items: center;
}

.playlist-item-drag:active {
    cursor: grabbing;
}

.playlist-item-drag i {
    font-size: 1.25rem;
}

.playlist-item-thumb {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: var(--radius-sm);
    background: var(--background-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.playlist-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.playlist-item-thumb i {
    font-size: 1.25rem;
    color: var(--text-light);
}

.playlist-item-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.playlist-item-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-item-url {
    font-size: 0.7rem;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-item-actions {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.playlist-item-actions .btn-icon {
    width: 28px;
    height: 28px;
}

.playlist-item-actions .btn-icon i {
    font-size: 1rem;
}

.playlist-item-toggle {
    position: relative;
    width: 36px;
    height: 20px;
}

.playlist-item-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.playlist-item-toggle .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: 0.3s;
    border-radius: 20px;
}

.playlist-item-toggle .slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.playlist-item-toggle input:checked + .slider {
    background-color: var(--success-color);
}

.playlist-item-toggle input:checked + .slider:before {
    transform: translateX(16px);
}

/* URL input modal styles */
.url-input-inline {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--background-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.url-input-inline input {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.8rem;
}

.url-input-inline .btn {
    padding: 0.5rem 0.75rem;
}

/* Preview modal for playlist items */
.preview-modal-content {
    max-width: 800px;
    width: 90%;
}

.preview-modal-content h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    word-break: break-all;
}

.preview-container {
    width: 100%;
    min-height: 200px;
    max-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
}

.preview-container img {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
}

.preview-container video {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    outline: none;
}

.preview-container iframe {
    width: 100%;
    height: 400px;
    border: none;
}

.preview-container p {
    padding: 2rem;
    text-align: center;
}

.preview-container .preview-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-light);
}

/* Responsive preview modal */
@media (max-width: 768px) {
    .preview-modal-content {
        width: 95%;
        padding: 1rem;
    }

    .preview-container {
        max-height: 50vh;
    }

    .preview-container iframe {
        height: 250px;
    }
}

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

    .upload-dropzone {
        padding: 20px 15px;
    }

    .files-filter {
        flex-wrap: wrap;
    }
}

/* ==================== INFOBOARD MANAGER ==================== */

.infoboard-options {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--background-tertiary);
    border-radius: var(--radius-md);
}

.infoboard-options .form-row {
    margin-bottom: 0.5rem;
}

.infoboard-options .form-row:last-child {
    margin-bottom: 0;
}

.infoboard-options .form-group {
    margin-bottom: 0;
}

.infoboard-options .checkbox-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.infoboard-options .checkbox-inline input {
    width: auto;
    margin: 0;
}

.infoboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.infoboard-count {
    font-size: 0.8rem;
    color: var(--text-light);
}

.infoboard-items {
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--background-primary);
}

.infoboard-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-light);
}

.infoboard-empty i {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.infoboard-empty p {
    margin: 0;
    font-size: 0.85rem;
}

.infoboard-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--background-secondary);
    transition: background 0.2s ease;
}

.infoboard-item:last-child {
    border-bottom: none;
}

.infoboard-item:hover {
    background: var(--background-tertiary);
}

.infoboard-item.disabled {
    opacity: 0.5;
}

.infoboard-item.disabled .infoboard-item-text,
.infoboard-item.disabled .infoboard-item-value {
    text-decoration: line-through;
}

.infoboard-item-drag {
    cursor: grab;
    color: var(--text-light);
    padding: 0.25rem;
    display: flex;
    align-items: center;
}

.infoboard-item-drag:active {
    cursor: grabbing;
}

.infoboard-item-drag i {
    font-size: 1.25rem;
}

.infoboard-item-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--background-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: var(--text-light);
    font-size: 1rem;
}

.infoboard-item-icon:hover {
    border-color: var(--primary-color);
    background: rgba(197, 40, 40, 0.1);
}

.infoboard-item-icon i.fa-solid {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.infoboard-item-text {
    flex: 2;
    min-width: 100px;
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
}

.infoboard-item-value {
    flex: 1;
    min-width: 70px;
    max-width: 100px;
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
    text-align: right;
}

.infoboard-item-toggle {
    position: relative;
    width: 36px;
    height: 20px;
}

.infoboard-item-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.infoboard-item-toggle .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: 0.3s;
    border-radius: 20px;
}

.infoboard-item-toggle .slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.infoboard-item-toggle input:checked + .slider {
    background-color: var(--success-color);
}

.infoboard-item-toggle input:checked + .slider:before {
    transform: translateX(16px);
}

/* ==================== ICON PICKER ==================== */

.icon-search {
    width: 100%;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.icon-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.icon-category-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    background: var(--background-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-category-btn:hover {
    border-color: var(--primary-color);
    background: rgba(197, 40, 40, 0.1);
}

.icon-category-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--background-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.icon-option {
    width: 48px;
    height: 48px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--background-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.icon-option:hover {
    border-color: var(--primary-color);
    background: rgba(197, 40, 40, 0.1);
    color: var(--primary-color);
    transform: scale(1.1);
}

/* Responsive Infoboard */
@media (max-width: 600px) {
    .infoboard-item {
        flex-wrap: wrap;
    }

    .infoboard-item-text {
        flex: 1 1 100%;
        order: 2;
        margin-top: 0.5rem;
    }

    .infoboard-item-value {
        flex: 1 1 100%;
        order: 3;
        max-width: none;
        text-align: left;
    }
}

/* ============================================================================
   TOUR GUIADO - Driver.js Styles
   ============================================================================ */

/* Floating Help Button */
.help-tour-btn {
    position: fixed;
    bottom: 80px;
    right: 25px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(197, 40, 40, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 9000;
}

.help-tour-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(197, 40, 40, 0.6);
}

.help-tour-btn:active {
    transform: scale(0.95);
}

.help-tour-btn i {
    font-size: 28px;
    color: white;
}

/* Pulse animation for first-time visitors */
.help-tour-btn.pulse {
    animation: helpPulse 2s infinite;
}

@keyframes helpPulse {
    0% {
        box-shadow: 0 4px 15px rgba(197, 40, 40, 0.4);
    }
    50% {
        box-shadow: 0 4px 25px rgba(197, 40, 40, 0.8), 0 0 0 10px rgba(197, 40, 40, 0.1);
    }
    100% {
        box-shadow: 0 4px 15px rgba(197, 40, 40, 0.4);
    }
}

/* Driver.js Theme Customization */
.driver-popover {
    background: var(--background-secondary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-xl) !important;
    color: var(--text-primary) !important;
    max-width: 400px !important;
}

.driver-popover-title {
    font-family: 'Poppins', sans-serif !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    padding-bottom: 10px !important;
    border-bottom: 1px solid var(--border-color) !important;
    margin-bottom: 10px !important;
}

.driver-popover-description {
    font-family: 'Poppins', sans-serif !important;
    font-size: 0.9rem !important;
    color: var(--text-secondary) !important;
    line-height: 1.6 !important;
}

.driver-popover-description p {
    margin: 8px 0 !important;
}

.driver-popover-description ul,
.driver-popover-description ol {
    margin: 10px 0 !important;
    padding-left: 20px !important;
}

.driver-popover-description li {
    margin: 5px 0 !important;
}

.driver-popover-description strong {
    color: var(--primary-color) !important;
}

.driver-popover-description code {
    background: var(--background-tertiary) !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    font-size: 0.85rem !important;
    color: #3498db !important;
}

.driver-popover-description table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.driver-popover-description th,
.driver-popover-description td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.driver-popover-description th {
    background: rgba(255, 255, 255, 0.05);
}

/* Driver.js Navigation Buttons */
.driver-popover-navigation-btns {
    justify-content: space-between !important;
    padding-top: 15px !important;
    border-top: 1px solid var(--border-color) !important;
    margin-top: 15px !important;
}

.driver-popover-prev-btn,
.driver-popover-next-btn,
.driver-popover-done-btn {
    font-family: 'Poppins', sans-serif !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    padding: 8px 16px !important;
    border-radius: var(--radius-md) !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.driver-popover-prev-btn {
    background: var(--background-tertiary) !important;
    color: var(--text-secondary) !important;
}

.driver-popover-prev-btn:hover {
    background: var(--border-color) !important;
    color: var(--text-primary) !important;
}

.driver-popover-next-btn,
.driver-popover-done-btn {
    background: var(--primary-color) !important;
    color: white !important;
}

.driver-popover-next-btn:hover,
.driver-popover-done-btn:hover {
    background: var(--primary-dark) !important;
}

/* Driver.js Progress Bar */
.driver-popover-progress-text {
    font-family: 'Poppins', sans-serif !important;
    font-size: 0.75rem !important;
    color: var(--text-light) !important;
}

/* Driver.js Close Button */
.driver-popover-close-btn {
    color: var(--text-light) !important;
    font-size: 1.5rem !important;
}

.driver-popover-close-btn:hover {
    color: var(--primary-color) !important;
}

/* Driver.js Arrow */
.driver-popover-arrow-side-left.driver-popover-arrow,
.driver-popover-arrow-side-right.driver-popover-arrow,
.driver-popover-arrow-side-top.driver-popover-arrow,
.driver-popover-arrow-side-bottom.driver-popover-arrow {
    border-color: var(--background-secondary) !important;
}

/* Driver.js Overlay */
.driver-overlay {
    background: rgba(0, 0, 0, 0.5) !important;
}

/* Highlighted Element */
.driver-active-element {
    box-shadow: 0 0 0 4px rgba(197, 40, 40, 0.5) !important;
}

/* Mobile responsiveness for tour */
@media (max-width: 600px) {
    .help-tour-btn {
        bottom: 70px;
        right: 15px;
        width: 48px;
        height: 48px;
    }

    .help-tour-btn i {
        font-size: 24px;
    }

    .driver-popover {
        max-width: 320px !important;
        margin: 10px !important;
    }

    .driver-popover-title {
        font-size: 1rem !important;
    }

    .driver-popover-description {
        font-size: 0.85rem !important;
    }
}