/* Modern Components for Cookie API Card Builder */

/* Drag Select Box */
.drag-select-box {
    position: absolute;
    border: 2px dashed #ff6b6b;
    background-color: rgba(255, 107, 107, 0.1);
    pointer-events: none;
    z-index: 1000;
    border-radius: 4px;
}

/* Canvas Status */
.canvas-status {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
    text-align: center;
}

.canvas-status.has-elements {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.status-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.status-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 4px;
}

.canvas-status.has-elements .status-text {
    color: #22c55e;
}

.status-hint {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* Canvas Elements */
.canvas-element {
    position: absolute;
    cursor: move;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    border-radius: 0;
    overflow: visible;
}

.canvas-element[data-type="text"] {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
}

.canvas-element:hover:not(.locked) {
    border-color: var(--accent-color);
}

.canvas-element.selected:not(.locked) {
    border-color: var(--accent-color);
}

.canvas-element.multi-selected:not(.locked) {
    border-color: #ff6b35;
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.3);
}

.canvas-element.locked {
    opacity: 0.8;
    cursor: not-allowed;
}

.canvas-element.locked.selected {
    border-color: #3b82f6;
    border-style: dashed;
}

.canvas-element.locked::after {
    content: '🔒';
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.4);
    color: white;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 16px;
    z-index: 10001;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    opacity: 0.4;
}

/* Locked element when selected - add shadow */
.canvas-element.locked.selected {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

/* Locked element when multi-selected */
.canvas-element.locked.multi-selected {
    border-color: #3b82f6;
    border-style: dashed;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.canvas-element .resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--accent-color);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.canvas-element.selected .resize-handle {
    opacity: 1;
}

.resize-handle.nw { top: -6px; left: -6px; cursor: nw-resize; }
.resize-handle.ne { top: -6px; right: -6px; cursor: ne-resize; }
.resize-handle.sw { bottom: -6px; left: -6px; cursor: sw-resize; }
.resize-handle.se { bottom: -6px; right: -6px; cursor: se-resize; }

/* Layers Panel */
.layers-list {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
}

.layer-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-height: 60px;
}

.layer-item:hover {
    background: rgba(255, 107, 53, 0.1);
    border-color: rgba(255, 107, 53, 0.3);
}

.layer-item.card-layer {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border: 1px solid #475569;
    color: white;
    position: relative;
}

.layer-item.card-layer:hover {
    background: linear-gradient(135deg, #334155 0%, #475569 100%);
    border-color: #64748b;
}

.layer-item.card-layer .layer-name {
    font-weight: 600;
    color: #f1f5f9;
}

.layer-item.card-layer .layer-details {
    color: #cbd5e1;
}

.layer-item.card-layer::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, #10b981, #059669);
}

.layer-item.selected {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.15) 0%, rgba(255, 107, 53, 0.25) 100%);
    color: var(--text-primary);
    border: 1px solid rgba(255, 107, 53, 0.4);
    box-shadow: 0 1px 4px rgba(255, 107, 53, 0.1);
}

.layer-item.selected .layer-name {
    color: var(--text-primary);
    font-weight: 600;
}

.layer-item.selected .layer-details {
    color: var(--text-secondary);
    font-weight: 500;
}

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

.layer-icon {
    width: 36px;
    height: 36px;
    background: var(--accent-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-right: 12px;
    flex-shrink: 0;
    font-weight: bold;
    color: white;
}

.layer-info {
    flex: 1;
    min-width: 0;
}

.layer-name {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.layer-details {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1.2;
}

.layer-controls {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.layer-item:hover .layer-controls {
    opacity: 1;
}

.layer-btn {
    width: 24px;
    height: 24px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.layer-btn:hover {
    background: var(--accent-color);
    color: white;
}

.layer-btn.delete:hover {
    background: var(--error-color);
}

.no-layers {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.875rem;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    max-width: 900px;
    max-height: 80vh;
    width: 95%;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.help-modal-content {
    max-width: 95vw;
    max-height: 95vh;
    width: 1200px;
    height: 80vh;
}

.help-modal-body {
    display: flex;
    height: calc(100% - 80px);
    overflow: hidden;
}

.help-sidebar {
    width: 250px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    overflow-y: auto;
    flex-shrink: 0;
}

.help-sidebar h3 {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.help-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.help-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.help-nav-link:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.help-nav-link.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.help-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Warning box for mobile section */
.warning-box {
    background: var(--bg-secondary);
    border: 1px solid #ff6b6b;
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    border-left: 4px solid #ff6b6b;
}

.warning-box strong {
    color: #ff6b6b;
    font-weight: 600;
}


/* Mobile responsive for help modal */
@media (max-width: 768px) {
    .help-modal-content {
        width: 95vw;
        height: 90vh;
        max-width: none;
        max-height: none;
    }
    
    .help-modal-body {
        flex-direction: column;
        height: calc(100% - 60px);
    }
    
    .help-sidebar {
        width: 100%;
        height: auto;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 1rem;
    }
    
    .help-sidebar h3 {
        font-size: 0.875rem;
        margin-bottom: 0.75rem;
    }
    
    .help-nav {
        flex-direction: row;
        overflow-x: auto;
        gap: 0.375rem;
        padding-bottom: 0.5rem;
    }
    
    .help-nav-link {
        flex-shrink: 0;
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
        white-space: nowrap;
    }
    
    .help-content {
        padding: 1rem;
    }
}

.modal-header {
    background: var(--bg-secondary);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.modal-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.modal-header h2 {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

/* News List Styles */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.news-list-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border-left: 3px solid var(--accent-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.news-list-item:hover {
    background: var(--bg-tertiary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.news-item-icon {
    font-size: 1.5rem;
    width: 32px;
    text-align: center;
    flex-shrink: 0;
}

.news-item-content {
    flex: 1;
}

.news-item-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.news-item-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.news-item-preview {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* News Item Badge */
.news-item-badge {
    display: inline-block;
    background: #ff4444;
    color: white;
    font-size: 0.6rem;
    font-weight: bold;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    margin-left: 0.5rem;
    animation: pulse 2s infinite;
}

/* Badge Styles */
.news-badge, .help-badge, .templates-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 0.7rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
    padding: 0 4px;
    box-sizing: border-box;
}

/* Special styling for count badges */
.news-badge {
    border-radius: 10px;
    min-width: 20px;
    height: 20px;
    font-size: 0.65rem;
}

/* For large numbers, make it more pill-shaped */
.news-badge[data-count]:not([data-count="1"]):not([data-count="2"]):not([data-count="3"]):not([data-count="4"]):not([data-count="5"]):not([data-count="6"]):not([data-count="7"]):not([data-count="8"]):not([data-count="9"]) {
    border-radius: 10px;
    min-width: 24px;
    height: 20px;
    font-size: 0.6rem;
}

/* For large numbers, make it more pill-shaped */
.news-badge.large-count {
    border-radius: 10px;
    min-width: 24px;
    height: 20px;
    font-size: 0.6rem;
}

.templates-badge {
    position: relative;
    top: auto;
    right: auto;
    margin-left: 0.5rem;
    display: inline-flex;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.news-btn, .help-btn {
    position: relative;
}

/* News Detail Styles */
.news-detail-content {
    padding: 1rem 0;
}

.news-detail-item {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border-left: 3px solid var(--accent-color);
}

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

.news-detail-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.news-detail-item h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.75rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.news-detail-item p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 1rem 0;
}

.news-detail-item ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.news-detail-item li {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.25rem;
}

/* Help Content Styles */
.help-sections {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.help-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
}

.help-section h3 {
    color: var(--accent-color);
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.help-section ol, .help-section ul {
    margin: 0;
    padding-left: 1.5rem;
}

.help-section li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.help-section li strong {
    color: var(--accent-color);
}

.help-section kbd {
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-family: monospace;
    font-size: 0.875rem;
    margin-right: 0.5rem;
}

/* Help Content Lists */
.element-list, .action-list, .control-list, .property-list, 
.mobile-list, .shortcut-list, .tip-list, .troubleshoot-list, 
.integration-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.help-section .element-item, 
.help-section .action-item, 
.help-section .control-item, 
.help-section .property-item, 
.help-section .mobile-item, 
.help-section .shortcut-item, 
.help-section .tip-item, 
.help-section .troubleshoot-item, 
.help-section .integration-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 107, 53, 0.1);
    border-radius: 6px;
    padding: 0.75rem;
    line-height: 1.4;
    transition: all 0.2s ease;
}


.help-section .element-item strong, 
.help-section .action-item strong, 
.help-section .control-item strong, 
.help-section .property-item strong, 
.help-section .mobile-item strong, 
.help-section .tip-item strong, 
.help-section .troubleshoot-item strong, 
.help-section .integration-item strong {
    color: var(--accent-color);
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.shortcut-item kbd {
    background: var(--accent-color);
    color: white;
    border: none;
    margin-right: 0.5rem;
}

.integration-item code {
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    display: block;
    margin-top: 0.5rem;
    line-height: 1.4;
    border: 1px solid var(--border-color);
}

.integration-item a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}

.help-section .integration-item a:hover {
    text-decoration: underline;
}

/* Export Options */
.export-options {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

.export-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.export-option:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.export-option span {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.export-option h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
}

.export-option p {
    font-size: 0.875rem;
    margin: 0;
    opacity: 0.8;
}

/* JSON Preview */
.json-preview {
    margin-bottom: 1.5rem;
}

.json-preview h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.json-preview h4::before {
    content: '🔄';
    animation: spin 2s linear infinite;
}

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

.json-preview textarea {
    width: 100%;
    height: 300px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.75rem;
    padding: 1rem;
    resize: vertical;
    line-height: 1.5;
    transition: all 0.2s ease;
}

.json-preview textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

/* Help Sections */
.help-sections {
    display: grid;
    gap: 2rem;
}

.help-section {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.help-section h3 {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.help-section ol, .help-section ul {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
    padding-left: 1.5rem;
}

.help-section li {
    margin-bottom: 0.5rem;
}

.help-section kbd {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-primary);
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 10001;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 400px;
    animation: slideIn 0.3s ease;
    backdrop-filter: blur(10px);
}


.toast.success {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

.toast.error {
    border-color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
}

.toast.warning {
    border-color: var(--warning-color);
    background: rgba(245, 158, 11, 0.1);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}


/* Loading States */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Tooltips */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles */
*:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-secondary: #000000;
    }
    
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}