/* Common Resource Page Styling */
/* This file contains shared styles for all resource pages */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ===== BASE STYLES ===== */
body {
    font-family: 'Inter', Roboto, "Helvetica Neue", sans-serif;
    background-color: #f4f4f9;
    margin: 0;
    padding: 20px;
    color: #333;
}

h1 {
    color: #2B4051;
    margin-top: 0;
    margin-bottom: 10px;
    display: inline-block;
    white-space: nowrap;
}

h1 span.material-symbols-outlined {
    font-size: 40px;
    font-variation-settings: 'FILL' 0, 'wght' 600, 'GRAD' 0, 'opsz' 48;
    color: #FE892F;
    position: relative;
    top: 3px;
    width: 40px;
}

p.header-description {
    color: #666;
    margin: 0 0 30px 0;
    font-size: 16px;
    line-height: 1.5;
}

/* ===== OPTIONS PANEL ===== */
.options-panel {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.options-panel h3 {
    color: #2B4051;
    margin: 0 0 20px 0;
    border-bottom: 2px solid #FE892F;
    padding-bottom: 10px;
    font-size: 18px;
}

.options-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #f8f9fa;
    min-width: fit-content;
    flex: 1;
    max-width: 300px;
    min-height: 62px;
    box-sizing: border-box;
}

.option-group:hover {
    background: #f0f0f0;
    border-color: #d0d0d0;
}

.option-group h4 {
    color: #2B4051;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.option-group label {
    font-weight: 500;
    color: #2B4051;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== FORM CONTROLS ===== */
/* Custom Select Styles */
.style-select {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.style-select:hover {
    border-color: #FE892F;
}

.style-select:focus {
    outline: none;
    border-color: #FE892F;
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.1);
}

.style-select:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
    border-color: #ddd;
}

.style-select:disabled:hover {
    border-color: #ddd;
}

/* Custom Checkbox */
.custom-checkbox {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.custom-checkbox:checked {
    background: #FE892F;
    border-color: #FE892F;
}

.custom-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.custom-checkbox:hover {
    border-color: #FE892F;
}

.custom-checkbox:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.2);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-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;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #FE892F;
}

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

/* ===== VIEW LAYOUT ===== */
.view-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
    margin-top: 30px;
}

.content-area {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

/* ===== DATA PANEL ===== */
.data-panel {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    height: fit-content;
    position: sticky;
    top: 20px;
    min-height: 910px;
}

.data-panel h3 {
    color: #2B4051;
    margin: 0 0 15px 0;
    border-bottom: 2px solid #FE892F;
    padding-bottom: 10px;
    font-size: 18px;
}

/* ===== VIEW CONTAINERS ===== */
.view-container {
    display: none;
    background: white;
    border-radius: 8px;
}

.view-container.active {
    display: block;
}

/* ===== VIEW TOGGLE ===== */
.view-toggle {
    text-align: center;
    margin-top: 30px;
}

.toggle-buttons {
    display: inline-flex;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 4px;
    border: 1px solid #e0e0e0;
}

.toggle-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-btn:hover {
    background: #e8f4fd;
    color: #2B4051;
}

.toggle-btn.active {
    background: #FE892F;
    color: white;
}

/* ===== CODE EDITOR ===== */
.code-editor {
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
}

.json-textarea {
    width: 100%;
    min-height: 858px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    background: white;
    color: #333;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
    margin: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.json-textarea:focus {
    background: #f8f9fa;
    border-color: #FE892F;
}

/* ===== MOBILE VIEW ===== */
.mobile-view {
    position: relative;
    width: 100%;
    max-width: 375px;
    height: 812px;
    margin: 0 auto;
}

.iphone-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

.mobile-content {
    position: absolute;
    top: 16px;
    left: 20px;
    right: 20px;
    bottom: 16px;
    z-index: 1;
    overflow-y: auto;
    border-radius: 25px;
    background: #EFF0F2;
    padding: 50px 15px 120px; /* Extra bottom padding to ensure submit button and navigation are accessible */
}

/* ===== BROWSER VIEW ===== */
.browser-view {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.browser-header {
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.browser-dots {
    display: flex;
    gap: 8px;
}

.browser-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.browser-dot.red {
    background-color: #ff5f56;
}

.browser-dot.yellow {
    background-color: #ffbd2e;
}

.browser-dot.green {
    background-color: #27ca3f;
}

.browser-title {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.browser-viewport {
    padding: 20px;
    background: white;
    min-height: 200px;
}

/* ===== RESOURCE STYLES ===== */
.resource {
    margin-bottom: 20px;
}


/* ===== STYLE PREVIEWS ===== */
.style-item {
    margin-bottom: 20px;
    padding: 10px;
    background: white;
}

.style-label {
    font-weight: 600;
    color: #2B4051;
    margin-bottom: 10px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.all-styles-preview {
    display: none;
}

.all-styles-preview.show {
    display: block;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1200px) {
    .view-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .data-panel {
        order: -1;
        position: static;
    }
}

@media (max-width: 950px) {
    .view-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .data-panel {
        order: -1;
        position: static;
        width: 100%;
        max-width: none;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .mobile-content {
        padding: 15px;
        padding-bottom: 120px; /* Extra bottom padding to ensure submit button and navigation are accessible */
    }
    
    .options-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .option-group {
        max-width: none;
    }
}

/* ===== CAROUSEL STYLES ===== */
.carousel-container {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    background: white;
    margin: 20px 0;
}

.carousel-track {
    display: flex;
    transition: transform 0.3s ease;
    width: 100%;
}

.carousel-slide {
    min-width: 100%;
    width: 100%;
    flex-shrink: 0;
    padding: 20px;
    box-sizing: border-box;
}

.carousel-slide:first-child {
    display: block;
}

.carousel-slide:not(:first-child) {
    display: none;
}

.carousel-slide.active {
    display: block;
}

.carousel-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.carousel-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
    min-width: 50px;
    text-align: center;
}

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

.carousel-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.carousel-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dee2e6;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.carousel-dot.active {
    background: #6c757d;
    transform: scale(1.2);
}

.carousel-text {
    margin: 10px 0;
    line-height: 1.6;
}

.carousel-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 10px 0;
}

.carousel-video {
    width: 100%;
    height: 200px;
    border-radius: 8px;
    margin: 10px 0;
}

.carousel-error {
    padding: 15px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    color: #721c24;
    text-align: center;
    margin: 10px 0;
}

.carousel-unknown {
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    color: #856404;
    text-align: center;
    margin: 10px 0;
}

.resource-placeholder {
    padding: 20px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 4px;
    color: #6c757d;
    text-align: center;
    font-style: italic;
}

/* Loading overlay and spinner for carousel */
.carousel-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.8);
    z-index: 5;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e9ecef;
    border-top-color: #6c757d;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Carousel form styles */
.carousel-config {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.carousel-config h4 {
    margin-top: 0;
    color: #2B4051;
}

.carousel-items {
    margin-top: 20px;
}

.carousel-item {
    margin-bottom: 15px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.carousel-item h5 {
    margin-top: 0;
    color: #2B4051;
}

.carousel-resource-item {
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.carousel-resource-fields {
    margin-top: 10px;
}

.carousel-resource-fields input,
.carousel-resource-fields textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 5px;
}

.carousel-resource-fields textarea {
    resize: vertical;
    min-height: 60px;
}

/* ===== RESOURCE PICKER MODAL STYLES ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #2B4051;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.modal-body {
    padding: 20px;
}

.resource-picker-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 20px;
}

.tab-button {
    background: none;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: #666;
}

.tab-button.active {
    color: #2B4051;
    border-bottom-color: #2B4051;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.resource-filter {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

.resource-filter input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.resource-filter select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 150px;
}

.resources-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.resource-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
}

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

.resource-info {
    flex: 1;
}

.resource-info strong {
    display: block;
    color: #2B4051;
    margin-bottom: 5px;
}

.resource-preview {
    color: #666;
    font-size: 14px;
}

.action-button.small {
    padding: 5px 10px;
    font-size: 12px;
}

.create-resource-form {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.create-resource-form h4 {
    margin-top: 0;
    color: #2B4051;
}

/* ===== CAROUSEL RESOURCE PICKER STYLES ===== */
.carousel-resource-picker {
    margin-bottom: 15px;
}

.resource-picker-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

.resource-type-filter {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 120px;
}

.selected-resources {
    min-height: 60px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.no-resources {
    color: #666;
    font-style: italic;
    margin: 0;
    text-align: center;
}

.selected-resource-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 8px;
    gap: 10px;
}

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

.resource-title {
    flex: 1;
    color: #2B4051;
    font-size: 14px;
}

/* ===== INLINE RESOURCE STYLES ===== */
.carousel-item-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.carousel-item-title {
    font-weight: 600;
    color: #2B4051;
    font-size: 16px;
}

.carousel-item-close {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.carousel-item-close:hover {
    background: #e0e0e0;
    color: #333;
}

.carousel-resources {
    padding: 20px;
    min-height: 100px;
}

.carousel-resource-actions {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
    justify-content: center;
    flex-wrap: wrap;
}



/* ===== MAIN RESOURCE TYPE BUTTONS STYLES ===== */
.resource-type-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* Ensure resource icons in action buttons are properly sized */
.action-button .resource-icon {
    width: 15px !important;
    height: 15px;
    object-fit: contain;
}

/* Base action-button styles to match table button sizes */
.action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    font-size: 11px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: white;
    color: #2B4051;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    min-width: auto;
}

.action-button:hover {
    background: #f8f9fa;
    border-color: #2B4051;
}

.action-button.secondary {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
}

.action-button.secondary:hover {
    background: #5a6268;
    border-color: #5a6268;
}

/* Override any default button sizing for resource type buttons */
.resource-type-buttons .action-button {
    padding: 4px 8px !important;
    font-size: 11px !important;
    min-width: auto !important;
    height: auto !important;
    width: auto !important;
}



/* ===== FLEX CONTAINER STYLES ===== */
.flex-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

/* ===== MOBILE RESPONSIVE STYLES ===== */
@media (max-width: 768px) {
    .flex-container {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    

    

    
    .resource-form-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .resource-form-row .drag-handle {
        align-self: flex-start;
    }
    
    .resource-form-row label {
        min-width: auto;
        text-align: left;
    }
    
    .resource-form-row .resource-input {
        min-width: auto;
        width: 100%;
    }
    
    .resource-form-row .action-button {
        align-self: flex-end;
    }
    
    .carousel-item-header {
        padding: 10px 15px;
    }
    
    .carousel-resources {
        padding: 15px;
    }
    
    .carousel-resource-actions {
        padding: 10px 15px;
        gap: 8px;
    }
    

    
    #totalDuration {
        text-align: center;
        font-size: 14px;
    }
}

@media (max-width: 480px) {

    

    

    
    .resource-form-row {
        gap: 6px;
    }
    
    .inline-resource {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    /* Make table responsive on mobile */
    .resources-table {
        font-size: 12px;
    }
    
    .resources-table th,
    .resources-table td {
        padding: 8px 4px;
    }
    
    .resources-table .action-button {
        padding: 4px 8px;
        font-size: 11px;
    }
}

.inline-resource {
    margin-bottom: 15px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
}

.resource-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.resource-form label {
    font-weight: 600;
    color: #2B4051;
    font-size: 14px;
}

.resource-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.resource-form-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.resource-form-row .drag-handle {
    flex-shrink: 0;
}

.resource-form-row label {
    flex-shrink: 0;
    min-width: 80px;
}

.resource-form-row .resource-input {
    flex: 1;
    min-width: 200px;
}

.resource-form-row .action-button {
    flex-shrink: 0;
}

.drag-handle {
    cursor: grab;
    color: #999;
    font-size: 16px;
    user-select: none;
    padding: 2px;
    border-radius: 3px;
    transition: color 0.2s ease;
}

.drag-handle:hover {
    color: #2B4051;
}

.drag-handle:active {
    cursor: grabbing;
}

.resource-input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.resource-input:focus {
    outline: none;
    border-color: #2B4051;
    box-shadow: 0 0 0 2px rgba(43, 64, 81, 0.1);
}

.resource-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.action-button.small {
    padding: 6px 12px;
    font-size: 12px;
    min-height: auto;
}

/* ===== DELETE CONFIRMATION MODAL STYLES ===== */
.modal-content.small {
    max-width: 500px;
}

.warning-text {
    color: #dc3545;
    font-weight: 600;
    margin: 10px 0;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.action-button.danger {
    background: #dc3545;
    color: white;
}

.action-button.danger:hover {
    background: #c82333;
}

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

.action-button.secondary:hover {
    background: #5a6268;
}

/* ===== CONFIG NOTE STYLES ===== */
.config-note {
    color: #666;
    font-style: italic;
    margin: 10px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #007bff;
}
