/* Profile Editor Styles */
.profile-editor {
    background: var(--panel-background);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

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

.panel-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.panel-header .header-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filename-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.current-filename {
    font-size: 0.9rem;
    color: var(--secondary-color);
    font-family: monospace;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
}

.current-filename:hover {
    background: rgba(0, 0, 0, 0.05);
}

.filename-input {
    font-size: 0.9rem;
    font-family: monospace;
    padding: 2px 4px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    width: 300px;
}

.filename-input.hidden {
    display: none;
}

.edit-filename-btn {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    opacity: 0.6;
    font-size: 0.9rem;
}

.edit-filename-btn:hover {
    opacity: 1;
}

/* Form Sections */
.form-section {
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.form-section h3 {
    color: var(--secondary-color);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.form-section h3::before {
    content: '';
    display: block;
    width: 4px;
    height: 1.1rem;
    background: var(--primary-color);
    border-radius: 2px;
    margin-bottom: 0rem;
}

/* Remove old collapsible styles */
.form-section h3::after {
    display: none; /* Remove the duplicate arrow */
}

.form-section h3::before {
    margin-right: 0.5rem; /* Adjust spacing for the indicator bar */
}

/* Form Grid Layout */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-grid .input-group {
    margin: 0;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--secondary-color);
    margin-bottom: 0.25rem;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    background: #f8f9fa;
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Web Clips Section */
.section-header {
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header.collapsible {
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Section header title */
.section-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

/* Section content padding */
.section-content {
    padding: 1rem;
}

/* Section actions alignment */
.section-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Profile actions spacing */
.profile-actions {
    margin: 2rem 0;
    padding: 0;
    display: flex;
    gap: 1rem;
}

/* Webclips section specific */
.webclips-section .section-content {
    padding: 1rem 1.5rem;
}

/* Remove old styles */
.actions {
    display: none;
}

/* Basic info section form grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-grid .span-2 {
    grid-column: span 2;
}

/* Input groups */
.input-group {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
}

.input-group label {
    font-weight: 500;
    color: var(--text-color);
}

.input-group input,
.input-group textarea {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
}

/* Profile Settings */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.setting-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    margin-top: 0.5rem;
}

.setting-item label {
    margin: 0;
    flex: 1;
}

.setting-item input[type="text"] {
    margin-top: 0.5rem;
    width: 100%;
}

/* Action Buttons */
.actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.actions button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.actions button.primary {
    background: var(--primary-color);
    color: white;
    border: none;
}

.actions button.primary:hover {
    background: var(--primary-color-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.2);
}

.actions button.secondary {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.actions button.secondary:hover {
    background: rgba(0, 123, 255, 0.05);
}

.actions button.text-button {
    background: none;
    border: none;
    color: var(--secondary-color);
    padding: 0.75rem 1rem;
}


/* Responsive Adjustments */
@media (max-width: 768px) {
    .profile-editor {
        padding: 1.5rem;
    }

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

    .actions {
        flex-direction: column;
    }

    .actions button {
        width: 100%;
    }
}

/* Saved Profiles Grid */
.profiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.profile-card {
    background: var(--panel-background);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.profile-card:hover {
    transform: translateX(4px);
    box-shadow: -4px 4px 12px rgba(0, 0, 0, 0.1);
}

.profile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.profile-card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

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

.profile-card-content {
    font-size: 0.9rem;
    color: var(--secondary-color);
}

.profile-meta {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

/* Modal base styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px); /* Safari support */
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: auto;
    position: relative;
}

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

.modal-body {
    padding: 1.5rem;
}

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

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--secondary-color);
    padding: 0.5rem;
}

.close-modal:hover {
    color: var(--primary-color);
}

/* Code Preview */
pre code {
    display: block;
    padding: 1rem;
    background: var(--background-color);
    border-radius: 4px;
    overflow-x: auto;
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* File Browser Styles */
.profile-files {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

.files-container {
    display: flex;
    flex-direction: column;
}

.file-section:first-child {
    order: -1;
}

.file-section h4 {
    /* margin-bottom: 1rem; */
    color: var(--secondary-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.file-list {
    background: var(--background-color);
    border-radius: 8px;
    /* padding: 1rem; */
    min-height: 200px;
}

.file-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    background: white;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.file-item:hover {
    background: #f8f9fa;
    border-color: var(--primary-color);
}

.file-item.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.file-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.file-item:hover .file-actions,
.file-item.selected .file-actions {
    opacity: 1;
}

.file-actions button {
    background: none;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-item:not(.selected) .file-actions button {
    color: var(--secondary-color);
}

.file-item:not(.selected) .file-actions button:hover {
    color: var(--primary-color);
    background: rgba(0, 123, 255, 0.1);
}

.file-item.selected .file-actions button {
    color: white;
}

.file-item.selected .file-actions button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.file-item.deployed {
    background: #f8fff8;
    border-color: #28a745;
}

.deploy-file {
    color: #0d6efd !important;
}

.deploy-file.deployed {
    color: #28a745 !important;
    cursor: default;
}

.file-item.deployed.selected {
    background: #28a745;
    border-color: #28a745;
}

.file-icon {
    margin-right: 0.75rem;
    font-size: 1.2rem;
}

.file-info {
    flex: 1;
}

.file-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.file-meta {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

.file-item.selected .file-meta {
    color: rgba(255, 255, 255, 0.7);
}

/* Error Message Styles */
.error-message {
    background: #fee;
    color: #c00;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
    border: 1px solid #fcc;
}

.error-state {
    color: #c00;
    text-align: center;
    padding: 2rem;
    background: #fee;
    border-radius: 4px;
    border: 1px solid #fcc;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--secondary-color);
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--secondary-color);
    background: var(--background-color);
    border-radius: 4px;
}

/* Success Message Styles */
.success-message {
    background: #e6ffe6;
    color: #006600;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
    border: 1px solid #99ff99;
}

/* File Actions */
.file-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.file-item.selected .file-actions {
    opacity: 1;
}

.file-item.selected .file-meta {
    color: rgba(255, 255, 255, 0.7);
}

/* Add these new header styles at the top of profiles.css */
.app-header {
    background: linear-gradient(135deg, #2C3E50 0%, #3498DB 100%);
    padding: 1rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: white;
    font-weight: 600;
    font-size: 1.25rem;
    transition: transform 0.2s ease;
}

.logo:hover {
    transform: translateY(-1px);
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.logo-text {
    background: linear-gradient(135deg, #FFF 0%, rgba(255, 255, 255, 0.8) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.nav-menu {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

/* Add responsive styles */
@media (max-width: 768px) {
    .header-container {
        padding: 0 1rem;
    }

    .logo-text {
        font-size: 1.25rem;
    }

    .nav-menu {
        gap: 0.5rem;
    }

    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
}

/* Add a subtle animation for the active link */
.nav-link.active {
    position: relative;
    overflow: hidden;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #FF6B6B, #4ECDC4);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.nav-link.active:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* Update the main container layout */
main {
    display: grid;
    grid-template-columns: 1fr 2fr; /* 1/3 for profiles list, 2/3 for edit form */
    gap: 2rem;
    align-items: start;
}

/* Move saved profiles section to the left */
.saved-profiles {
    grid-column: 1;
    grid-row: 1;
    position: sticky;
    top: 100px; /* Account for header height + some padding */
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: var(--panel-background);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* Move profile editor to the right */
.profile-editor {
    grid-column: 2;
    grid-row: 1;
}

/* Responsive layout */
@media (max-width: 1024px) {
    main {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .saved-profiles,
    .profile-editor {
        grid-column: 1;
        position: static;
        max-height: none;
    }

    .saved-profiles {
        grid-row: 1;
    }

    .profile-editor {
        grid-row: 2;
    }
}

/* Adjust profile cards for the new layout */
.profiles-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

/* Add visual feedback for selected profile */
.profile-card.selected {
    border-color: var(--primary-color);
    background: rgba(0, 123, 255, 0.05);
}

/* Web Clip Styles */
.webclip-item {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.webclip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.webclip-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.webclip-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.webclip-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.webclip-summary .webclip-icon {
    width: 40px;
    height: 40px;
}

.webclip-label {
    font-weight: 500;
    color: #333;
}

.webclip-content {
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
    display: block;
    transition: all 0.2s ease;
}

.webclip-item.collapsed .webclip-content {
    display: none;
}

.expand-toggle {
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: none;
    color: var(--secondary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: transform 0.2s;
}


.form-grid.compact {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.form-grid.compact .input-group {
    margin: 0;
}

.form-grid.compact label {
    display: block;
    font-size: 0.8rem;
    color: var(--secondary-color);
    margin-bottom: 0.25rem;
}

.form-grid.compact input {
    width: 100%;
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
}

.icon-upload {
    grid-column: span 2;
    margin-top: 0.5rem;
}

.icon-preview {
    width: 90px;
    height: 90px;
    border-radius: 18px;
    border: 2px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.icon-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.webclip-icon, 
.webclip-preview {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    object-fit: cover;
}

.webclip-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.webclip-summary .webclip-icon {
    width: 40px;
    height: 40px;
}

/* Remove file input and upload button */
.icon-preview input[type="file"],
.icon-preview .upload-btn {
    display: none;
}

.icon-preview.has-image {
    border-style: solid;
    border-color: var(--primary-color);
}

/* Ensure icon visibility */
.icon-preview img:not(.hidden) {
    display: block;
}

.webclip-options {
    display: grid;
    grid-template-columns: repeat(3, auto);
    gap: 1.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--secondary-color);
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

/* Make form sections collapsible */
.form-section h3 {
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.form-section h3::after {
    content: '▼';
    margin-left: 0.5rem;
    font-size: 0.8em;
    transition: transform 0.2s;
}

.form-section.collapsed h3::after {
    transform: rotate(-90deg);
}

.form-section.collapsed .form-grid,
.form-section.collapsed .settings-grid,
.form-section.collapsed #webclips-container {
    display: none;
}

/* Add transition for smooth expansion */
.webclip-content {
    transition: all 0.2s ease;
}

/* Additional form styles */
.span-2 {
    grid-column: span 2;
}

.input-group input[readonly] {
    background: #f8f9fa;
    cursor: not-allowed;
}

textarea {
    width: 100%;
    min-height: 80px;
    resize: vertical;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #f8f9fa;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Improve section spacing */
.form-section {
    margin-bottom: 2rem;
}

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

/* Improve form grid layout */
.form-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .span-2 {
        grid-column: auto;
    }
}

/* Update Icon Grid Styles */
.icons-preview {
    margin-top: 2rem;
}

.icons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    min-height: 100px;
}

.icons-grid .no-icons {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--secondary-color);
    padding: 2rem;
}

.icon-item {
    aspect-ratio: 1;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.icon-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.icons-grid.large {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}

.icon-item.large img {
    width: 120px;
    height: 120px;
}

/* View options */
.view-options {
    display: flex;
    gap: 0.5rem;
    margin-left: 1rem;
}

.view-options button {
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
    border-radius: 4px;
}

.view-options button.active {
    background: var(--primary-color);
    color: white;
}

/* Collapsible Section Styles */
.section-header.collapsible {
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* padding: 0.5rem 0; */
}

.section-header .section-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toggle-section {
    background: none;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    color: var(--secondary-color);
    transition: transform 0.2s ease;
}

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

/* Ensure smooth transition */
.section-content {
    transition: all 0.2s ease;
}

.form-section.collapsed .section-content {
    display: none;
}

/* Update section spacing */
.form-section {
    margin-bottom: 1rem;
}

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

/* Update settings styles */
.setting-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    margin-top: 0.5rem;
}

.setting-item label {
    margin: 0;
    flex: 1;
}

.setting-item input[type="text"] {
    margin-top: 0.5rem;
    width: 100%;
}

.panel-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

#recognize-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    color: var(--primary-color);
    border: 1px solid currentColor;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

#recognize-profile:hover {
    background: rgba(0, 123, 255, 0.05);
    transform: translateY(-1px);
}

#recognize-profile .icon {
    font-size: 1.1em;
}

/* Update file sections to be collapsible */
.file-section {
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.file-section .section-header {
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.file-section.collapsed .section-content {
    display: none;
}

.file-section .section-content {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.profile-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.profile-actions button {
    flex: 1;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

.webclip-item.has-error {
    border-color: #ff4444;
}

.error-icon {
    color: #ff4444;
    cursor: help;
    margin-left: 8px;
}

.section-header {
    display: flex;
    align-items: center;
}

/* Validation Dialog Styles */
.error-dialog {
    padding: 0;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    margin: auto;
}

.error-dialog .dialog-content {
    padding: 1.5rem;
}

.error-dialog h3 {
    margin: 0 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.error-counts {
    font-size: 0.9rem;
    font-weight: normal;
}

.total-count {
    color: var(--error-color);
}

.fixable-count {
    background: var(--success-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    margin-left: 0.5rem;
}

.error-list {
    max-height: calc(80vh - 150px);
    overflow-y: auto;
    margin: 1rem -1.5rem;
    padding: 0 1.5rem;
}

.error-item {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.error-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.error-suggestion {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--secondary-color);
}

.dialog-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.fix-btn, .fix-all-btn {
    padding: 6px 16px;
    border-radius: 6px;
    border: 1px solid #0d6efd;
    background: white;
    color: #0d6efd;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.fix-btn:hover, .fix-all-btn:hover {
    background: #0d6efd;
    color: white;
}

.close-btn {
    padding: 6px 16px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    background: white;
    color: #495057;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.error-item.fixed .fix-btn {
    background: #28a745;
    border-color: #28a745;
    color: white;
    pointer-events: none;
}

/* Highlight invalid fields */
.highlight-error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25);
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Update collapsed webclip style */
.webclip-item.collapsed {
    background: #f8f9fa;
}

.webclip-item.collapsed.has-error {
    background: #fff5f5;
}

.webclip-item.collapsed .webclip-header {
    border-bottom: none;
}

/* Improve error icon placement */
.error-icon {
    order: 1;
    margin-left: auto;
    padding: 4px;
}

/* Add transition for expand/collapse */
.webclip-content {
    transition: all 0.3s ease;
}

/* Message styles */
.message {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 8px;
  background: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s ease;
}

.message-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.message-warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
}

.message-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Update error item styles */
.error-item.fixed {
  position: relative;
}

.error-item.fixed::before {
  content: '✓';
  position: absolute;
  top: 50%;
  right: -8px;
  transform: translateY(-50%);
  color: #28a745;
  font-size: 1.2em;
  opacity: 0;
  animation: check-mark 0.3s ease forwards;
}

@keyframes check-mark {
  from {
    opacity: 0;
    transform: translate(-10px, -50%);
  }
  to {
    opacity: 1;
    transform: translate(0, -50%);
  }
}

button {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: none;
    color: rgb(8, 43, 241);
    cursor: pointer;
}

/* Improve collapsed state styling */
.webclip-item.collapsed .webclip-header {
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #dee2e6;
}

.webclip-item.collapsed.has-error .webclip-header {
  background: #fff5f5;
  border-color: #dc3545;
}

/* Quick Webclips Modal Improvements */
.webclips-layout {
  display: flex;
  gap: 1.5rem;
  height: 500px;
}

.categories-sidebar {
  width: 200px;
  border-right: 1px solid var(--border-color);
  padding-right: 1rem;
  overflow-y: auto;
}

.category-btn {
  width: 100%;
  text-align: left;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.category-btn:hover {
  background: rgba(var(--primary-rgb), 0.05);
  border-color: var(--primary-color);
}

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

.category-btn.active .count {
  color: rgba(255, 255, 255, 0.8);
}

/* Add Category/Webclip buttons */
.add-new-btn {
  width: 100%;
  padding: 0.75rem;
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  background: transparent;
  color: var(--secondary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  margin-top: 1rem;
}

.add-new-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: rgba(var(--primary-rgb), 0.05);
}

.add-new-btn .icon {
  font-size: 1.2rem;
}

.webclips-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.search-bar {
  margin-bottom: 1rem;
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.search-bar .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--secondary-color);
}

.webclips-grid {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.webclip-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.webclip-card:hover {
  border-color: var(--primary-color);
  background: rgba(var(--primary-rgb), 0.02);
}

.webclip-card.selected {
  background: rgba(var(--primary-rgb), 0.05);
  border-color: var(--primary-color);
}

.webclip-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
}

.webclip-info {
  overflow: hidden;
}

.webclip-title {
  font-weight: 500;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.webclip-meta,
.webclip-url {
  font-size: 0.8rem;
  color: var(--secondary-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.webclip-actions {
  display: flex;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.webclip-actions button {
  padding: 0.5rem;
  border-radius: 6px;
  color: var(--secondary-color);
  transition: all 0.2s ease;
  background: transparent;
  border: none;
  cursor: pointer;
}

.webclip-actions .edit-webclip:hover {
  color: var(--primary-color);
  background: rgba(var(--primary-rgb), 0.1);
}

.webclip-actions .delete-webclip:hover {
  color: #dc3545;
  background: rgba(220, 53, 69, 0.1);
}

.webclip-card:hover .webclip-actions {
  opacity: 1;
}

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

.selection-bar {
  padding: 1rem;
  background: #f8f9fa;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.selection-info {
  font-size: 0.9rem;
  color: var(--secondary-color);
}

/* Prompt Dialog Styles */
.prompt-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  border: none;
  border-radius: 12px;
  padding: 0;
  max-width: 500px;
  width: 90%;
  background: white;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}

.prompt-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.prompt-dialog form {
  padding: 1.5rem;
}

.prompt-dialog h3 {
  margin: 0 0 1.5rem 0;
  font-size: 1.2rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.1);
}

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

/* Add animation */
.prompt-dialog[open] {
  animation: modal-fade 0.3s ease-out;
}

@keyframes modal-fade {
  from {
    opacity: 0;
    transform: translate(-50%, -48%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* Icon upload styles */
.icon-input-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.icon-preview {
  width: 90px;
  height: 90px;
  border-radius: 18px;
  border: 2px dashed var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.icon-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.icon-preview img.hidden {
  display: none;
}

.icon-preview.has-image {
  border-style: solid;
  border-color: var(--primary-color);
}

/* Remove upload button styles */
.icon-preview input[type="file"],
.icon-preview .upload-btn {
  display: none;
}

.icon-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.icon-file-input {
  flex: 1;
}

.input-description {
  color: var(--secondary-color);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/* Add preview functionality */
.icon-preview.has-image {
  border-style: solid;
  border-color: var(--primary-color);
}

.icon-preview-section {
  margin-top: 2rem;
  text-align: center;
}

.icon-preview-section img {
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.icon-preview-section img.preview-small {
  width: 60px;
  height: 60px;
}

.icon-preview-section img.preview-large {
  width: 120px;
  height: 120px;
}

.webclip-icon, .webclip-preview {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  object-fit: cover;
}

.icon-preview img {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  object-fit: cover;
}

.webclip-header .webclip-actions {
  display: flex;
  gap: 0.5rem;
  opacity: 1; /* Make always visible */
}

.webclip-header .btn-icon {
  padding: 0.4rem;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 4px;
  color: var(--secondary-color);
  transition: all 0.2s ease;
}

.webclip-header .btn-icon:hover {
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
}

.webclip-header .remove-webclip {
  font-size: 1rem;
}

.sign-file {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.sign-file:hover {
  opacity: 1;
}

.file-item.signed .sign-file {
  color: #28a745;
}

/* Login Dialog Styles */
.login-dialog.centered {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

.login-dialog .dialog-content {
  /* padding: 2rem; */
  min-width: 320px;
  max-width: 400px;
}

.auth-divider {
  position: relative;
  text-align: center;
  margin: 1.5rem 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 1.5rem);
  height: 1px;
  background: var(--border-color);
}

.auth-divider::before {
  left: 0;
}

.auth-divider::after {
  right: 0;
}

.auth-divider span {
  background: white;
  padding: 0 1rem;
  color: var(--secondary-color);
  font-size: 0.9rem;
}

.google-signin-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-color);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.google-signin-btn:hover {
  background: #f8f9fa;
  border-color: var(--text-color);
}

.google-signin-btn img {
  width: 18px;
  height: 18px;
}

/* Ensure dialog is above other content */
.login-dialog {
  z-index: 1000;
}

.login-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

/* Profile Menu Styles */
.profile-menu {
  position: relative;
  margin-left: 1rem;
}

.profile-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.profile-button:hover {
  background: rgba(255, 255, 255, 0.15);
}

.profile-icon {
  font-size: 1.2rem;
}

.profile-email {
  font-size: 0.9rem;
  font-weight: 500;
}

.profile-arrow {
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 240px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.profile-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.profile-info {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.profile-email-full {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-color);
  margin-bottom: 0.25rem;
}

.profile-role {
  display: block;
  font-size: 0.8rem;
  color: var(--secondary-color);
}

.profile-actions {
  padding: 0.75rem;
}

.sign-out-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  border-radius: 6px;
  color: #dc3545;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.sign-out-btn:hover {
  background: rgba(220, 53, 69, 0.1);
}

/* Add responsive styles */
@media (max-width: 768px) {
  .profile-email {
    display: none;
  }
  
  .profile-button {
    padding: 0.5rem;
  }
  
  .profile-dropdown {
    right: -1rem;
  }
}

body.loading {
  position: relative;
}

body.loading::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--background-color);
  z-index: 9998;
}

body.loading::after {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 9999;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

