.search-input, .language-filter {
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.search-input:hover, .language-filter:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.search-input:focus, .language-filter:focus {
    outline: none;
    border-color: #667eea;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    width: 500px;
    min-width: 500px;
    min-height: 500px;
    max-height: 650px;
    overflow-y: overlay; /* Use overlay scrollbar */
    margin: 0;
    scrollbar-gutter: stable;
}

/* Web app mode - full screen styles */
@media screen and (min-width: 769px) {
    body.web-mode {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        max-height: 100vh;
        min-height: 100vh;
    }
    
    body.web-mode .container {
        max-width: 1200px;
        margin: 0 auto;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
    }
}

/* Mobile responsive */
@media screen and (max-width: 768px) {
    body {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
    }
}

.container {
    background: white;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.title {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon {
    font-size: 20px;
}

.header-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.btn {
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:hover {
    background: #45a049;
}

.btn-primary.success-animation {
    animation: successPulse 0.6s ease;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: 1px solid #6c757d;
    min-width: 80px;
}

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

.btn-danger {
    background: #ff4757;
    color: white;
}

.btn-danger:hover {
    background: #ff3742;
}

.btn-sync {
    background: #5dade2;
    color: white;
    border: 1px solid #5dade2;
    min-width: 40px;
}

.btn-sync:hover {
    background: #3498db;
    border-color: #3498db;
}

.btn-sync.syncing {
    background: #f39c12;
    border-color: #f39c12;
}

.btn-sync.error {
    background: #e74c3c;
    border-color: #e74c3c;
}

.btn-auto-sync {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.btn-auto-sync:hover {
    background: #bbdefb;
    color: #0d47a1;
}

.btn-auto-sync.active {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
}

.btn-auto-sync.disabled {
    background: #f5f5f5;
    color: #9e9e9e;
    border-color: #e0e0e0;
    cursor: not-allowed;
}

.plus {
    font-size: 18px;
    font-weight: bold;
}

.search-container {
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    opacity: 1;
}

.search-container.hidden {
    opacity: 0;
    pointer-events: none;
}

.search-input {
    flex: 1;
    min-width: 200px;
}

.language-filter {
    min-width: 140px;
    flex-shrink: 0;
}

.snippet-form {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    width: 100%;
    box-sizing: border-box;
}

.form-group {
    margin-bottom: 16px;
    flex: 1;
}

.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.flex-1 {
    flex: 1;
}

.flex-2 {
    flex: 2;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #555;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-group input:hover, .form-group select:hover, .form-group textarea:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.form-group textarea {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    resize: vertical;
    min-height: 120px;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.snippets-list {
    flex: 1;
    padding: 20px;
    overflow-y: overlay;
    opacity: 1;
}

.snippets-list.hidden {
    opacity: 0;
}

.snippet-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    position: relative;
    opacity: 1;
}

.snippet-card:hover {
    /* transform: translateY(-2px) scale(1.01); */
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.snippet-header {
    padding: 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.snippet-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.snippet-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #666;
}

.language-badge {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.snippet-description {
    color: #666;
    font-size: 13px;
    margin-top: 4px;
}

.snippet-tags {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tag {
    background: #e9ecef;
    color: #666;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 11px;
}

.snippet-code {
    position: relative;
}

.snippet-code pre {
    margin: 0;
    padding: 16px;
    background: #2d3748;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.4;
    max-width: 100%;
    word-wrap: break-word;
}

.snippet-code code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.snippet-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 4px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    z-index: 10;
}

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

.action-btn {
    background: rgba(244, 67, 54, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    position: relative;
    z-index: 20;
}

.action-btn.edit-btn {
    background: rgba(33, 150, 243, 0.9);
}

.action-btn.edit-btn:hover {
    background: rgba(33, 150, 243, 1);
    transform: scale(1.1);
}

.action-btn:hover {
    background: rgba(244, 67, 54, 1);
    transform: scale(1.1);
}

.copy-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(76, 175, 80, 0.9);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: rgba(76, 175, 80, 1);
}

.copy-btn.copied {
    background: rgba(33, 150, 243, 0.9);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s ease forwards;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    animation: bounceIn 0.8s ease;
}

.empty-state h3 {
    margin-bottom: 8px;
    color: #333;
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Custom scrollbar - Hidden */
::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: transparent;
}

::-webkit-scrollbar-thumb:hover {
    background: transparent;
}

/* Hide scrollbar for Firefox */
* {
    scrollbar-width: none;
}

/* Show scrollbar for input elements */
input, textarea, select {
    scrollbar-width: auto;
}

input::-webkit-scrollbar, textarea::-webkit-scrollbar, select::-webkit-scrollbar {
    width: 8px;
}

input::-webkit-scrollbar-track, textarea::-webkit-scrollbar-track, select::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

input::-webkit-scrollbar-thumb, textarea::-webkit-scrollbar-thumb, select::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

input::-webkit-scrollbar-thumb:hover, textarea::-webkit-scrollbar-thumb:hover, select::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Animation for new snippets */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideOutUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-30px);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes formSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes dropdownSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes successPulse {
    0% {
        background: #4CAF50;
        transform: scale(1);
    }
    50% {
        background: #45a049;
        transform: scale(1.05);
    }
    100% {
        background: #4CAF50;
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.snippet-card.new {
    animation: fadeInUp 0.3s ease;
}

.btn:active {
    transform: scale(0.98);
}

.btn:focus {
    outline: 2px solid rgba(102, 126, 234, 0.3);
    outline-offset: 2px;
}

/* Loading state for buttons */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Stagger animation for snippet cards */
.snippet-card:nth-child(1) { animation-delay: 0s; }
.snippet-card:nth-child(2) { animation-delay: 0.1s; }
.snippet-card:nth-child(3) { animation-delay: 0.2s; }
.snippet-card:nth-child(4) { animation-delay: 0.3s; }
.snippet-card:nth-child(5) { animation-delay: 0.4s; }

/* Enhanced form field animations */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    animation: focusGlow 0.3s ease;
}

@keyframes focusGlow {
    0% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4); }
    100% { box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1); }
}

/* Copy button success animation */
.copy-btn.success-copy {
    background: rgba(76, 175, 80, 1) !important;
    animation: successPulse 0.5s ease;
}

/* Responsive adjustments */
@media (max-width: 500px) {
    body {
        width: 500px;
        min-width: 420px;
        max-width: 500px;
    }

    .search-container {
        flex-direction: column;
        padding: 12px 16px;
    }

    .language-filter {
        min-width: unset;
    }

    .header {
        padding: 12px 16px;
    }

    .title {
        font-size: 16px;
    }

    .btn {
        padding: 6px 10px;
        font-size: 13px;
    }
}

/* Ensure minimum dimensions */
.container {
    /* min-width: 420px; */
    width: 100%;
}

/* Prevent layout shifts when switching between views */
.snippet-form.hidden {
    display: none !important;
}

.snippets-list.hidden {
    display: none !important;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.7);
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    width: 450px;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

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

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-body {
    padding: 0 20px 20px;
}

.auth-info {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.auth-info h4 {
    margin: 0 0 12px;
    color: #333;
    font-size: 16px;
}

.auth-info p {
    margin: 0 0 12px;
    color: #666;
    font-size: 14px;
}

.auth-info ol {
    margin: 0;
    padding-left: 20px;
    color: #666;
    font-size: 14px;
}

.auth-info ol li {
    margin-bottom: 4px;
}

.auth-info a {
    color: #667eea;
    text-decoration: none;
}

.auth-info a:hover {
    text-decoration: underline;
}

.sync-status {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

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

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

.status-value {
    color: #666;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
}

.sync-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.sync-actions .btn {
    flex: 1;
    min-width: 120px;
}

.sync-progress {
    text-align: center;
    padding: 20px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
    animation: progressAnimation 2s ease-in-out infinite;
}

@keyframes progressAnimation {
    0%, 100% { width: 0%; }
    50% { width: 100%; }
}

.progress-text {
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

/* Auto sync button styles - kept for dropdown usage */
.btn-auto-sync {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.btn-auto-sync:hover {
    background: #bbdefb;
    color: #0d47a1;
}

.btn-auto-sync.active {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
}

.btn-auto-sync.disabled {
    background: #f5f5f5;
    color: #9e9e9e;
    border-color: #e0e0e0;
    cursor: not-allowed;
}

/* Sync button states */
.btn-sync.syncing {
    background: #ff9800;
    color: white;
    animation: pulse 1.5s infinite;
}

.btn-sync.error {
    background: #f44336;
    color: white;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Dropdown Menu Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 160px;
    z-index: 1000;
    padding: 4px 0;
    margin-top: 4px;
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    visibility: hidden;
}

.dropdown-menu.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    visibility: visible;
}

.dropdown-item {
    width: 100%;
    padding: 8px 16px;
    border: none;
    background: none;
    text-align: left;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-item:hover {
    background: #f8f9fa;
}

.dropdown-item:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.dropdown-item:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* Auto sync specific styling */
#autoSyncText {
    font-weight: 500;
    transition: color 0.2s ease;
}