* {
    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%);
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Login Screen Styles */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 40px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #2c3e50;
    font-size: 2.2em;
    margin-bottom: 8px;
    font-weight: 700;
}

.login-header p {
    color: #666;
    font-size: 1.1em;
}

.login-form {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-google {
    background: #db4437;
    color: white;
    margin-top: 15px;
}

.btn-google:hover {
    background: #c23321;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(219, 68, 55, 0.4);
}

.google-icon {
    width: 20px;
    height: 20px;
    background: white;
    padding: 2px;
    border-radius: 3px;
}

.divider {
    text-align: center;
    margin: 20px 0;
    color: #666;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e1e8ed;
}

.divider span {
    background: rgba(255, 255, 255, 0.95);
    padding: 0 15px;
}

.test-note {
    text-align: center;
    color: #666;
    font-size: 12px;
    margin-top: 15px;
}

/* Dashboard Styles */
.dashboard {
    display: none;
    padding: 80px 20px 80px 20px; /* Added bottom padding for user info */
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.dashboard.active {
    display: flex;
}

.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    object-fit: cover;
}

.user-name {
    color: white;
    font-size: 16px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.view-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 4px;
}

.view-label {
    color: white;
    font-size: 14px;
    font-weight: 500;
    padding: 0 8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.view-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

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

.view-btn.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.view-btn.active:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Top Right Controls - positioned below header (universal: mobile + desktop) */
.top-right-controls {
    position: fixed;
    top: 80px; /* Below the top-bar */
    right: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 999;
}

/* Bottom Left Email Info (universal: mobile + desktop) */
.bottom-left-user {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    z-index: 999;
}

.user-email {
    color: white;
    font-size: 14px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    text-decoration: none;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.theme-toggle-btn {
    padding: 8px;
    border-radius: 50%;
    position: relative;
    min-width: 44px;
    justify-content: center;
}

.theme-icon {
    width: 18px;
    height: 18px;
    transition: all 0.3s ease;
}

.refresh-btn {
    padding: 8px;
    border-radius: 50%;
}

.refresh-btn svg {
    width: 18px;
    height: 18px;
}

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

/* Dark Theme for Main Interface */
body.dark-theme {
    background: linear-gradient(135deg, #1a0f0f 0%, #2d1616 100%);
    color: #f2f2f7;
}

body.dark-theme .container {
    background: linear-gradient(135deg, #1a0f0f 0%, #2d1616 100%);
}

body.dark-theme .user-info {
    background: rgba(45, 22, 22, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .user-name {
    color: #f2f2f7;
}

body.dark-theme .action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f2f2f7;
}

body.dark-theme .action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-theme .header {
    /* No background override needed - inherits from base */
}

body.dark-theme .header h1 {
    color: #f2f2f7;
}

body.dark-theme .categories-container {
    background: rgba(26, 15, 15, 0.3);
}

body.dark-theme .folder-item {
    background: rgba(45, 22, 22, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f2f2f7;
}

body.dark-theme .folder-item:hover {
    background: rgba(60, 30, 30, 0.9);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

body.dark-theme .folder-icon {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .folder-item-label {
    color: #f2f2f7;
}

body.dark-theme .icon-subtitle {
    color: #8e8e93;
}

/* Dark theme for iOS folder popup */
body.dark-theme .ios-folder-popup {
    background: rgba(26, 15, 15, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .ios-folder-header h3 {
    color: #f2f2f7;
}

body.dark-theme .ios-folder-item {
    background: rgba(45, 22, 22, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-theme .ios-folder-item:hover {
    background: rgba(60, 30, 30, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .ios-app-icon {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .ios-app-label {
    color: #f2f2f7;
}

/* Dark theme for loading states */
body.dark-theme .loading-message {
    color: #8e8e93;
}

body.dark-theme .loading-dots::after {
    color: #8e8e93;
}

/* Dark theme for login screen */
body.dark-theme .login-container {
    background: rgba(26, 15, 15, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .login-title {
    color: #f2f2f7;
}

body.dark-theme .login-subtitle {
    color: #8e8e93;
}

body.dark-theme .google-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f2f2f7;
}

body.dark-theme .google-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Dark theme for logout modal */
body.dark-theme .logout-modal {
    background: rgba(26, 15, 15, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .logout-modal h3 {
    color: #f2f2f7;
}

body.dark-theme .logout-modal p {
    color: #8e8e93;
}

body.dark-theme .logout-modal .confirm-btn {
    background: #ff453a;
    color: white;
}

body.dark-theme .logout-modal .cancel-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f2f2f7;
}

body.dark-theme .logout-modal .cancel-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Dark theme for new positioned elements */
body.dark-theme .top-right-controls {
    /* Inherits view-toggle and action-btn dark styles automatically */
}

body.dark-theme .bottom-left-user {
    background: rgba(28, 28, 30, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .user-email {
    color: #f2f2f7;
}

.logout-btn {
    background: rgba(255, 59, 48, 0.2);
    border-color: rgba(255, 59, 48, 0.3);
}

.logout-btn:hover {
    background: rgba(255, 59, 48, 0.3);
}

.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 40px;
}

.header h1 {
    color: white;
    font-size: 2.5em;
    margin: 0 0 10px 0;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1em;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.icons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 30px;
    max-width: 1200px;
    width: 100%;
}

.icon-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.2s ease;
    cursor: pointer;
}

.icon-container:hover {
    transform: translateY(-5px);
}

.icon {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.icon:hover {
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.3);
}

.icon svg {
    width: 40px;
    height: 40px;
}

.badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff3b30;
    color: white;
    border-radius: 12px;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.icon-label {
    color: white;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    margin-bottom: 4px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.icon-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Folder Styles */
.folder-container {
    position: relative;
    z-index: 1;
    transition: z-index 0s ease 0.3s; /* Delay z-index change until after animation */
}

.folder-container.expanding {
    z-index: 1000; /* Bring to top immediately when expanding */
    transition: z-index 0s ease 0s; /* No delay when expanding */
}

.folder-container.expanded {
    z-index: 1000; /* Stay on top when expanded */
}

.folder-icon {
    background: linear-gradient(135deg, #f39c12, #e67e22) !important;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: visible;
}

.folder-icon::before {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Removed stacked icon effects as requested */

/* Logout Modal Styles */
.logout-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.logout-modal {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-align: center;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    opacity: 0;
}

.logout-modal-overlay.show .logout-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.logout-modal-header h3 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 24px;
    font-weight: 600;
}

.logout-modal-body p {
    margin: 0 0 30px 0;
    color: #5a6c7d;
    font-size: 16px;
    line-height: 1.5;
}

.logout-modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.logout-btn-cancel,
.logout-btn-confirm {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.logout-btn-cancel {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
    border: 2px solid rgba(108, 117, 125, 0.3);
}

.logout-btn-cancel:hover {
    background: rgba(108, 117, 125, 0.2);
    transform: translateY(-2px);
}

.logout-btn-confirm {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.logout-btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to { 
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.folder-container:hover .folder-icon::before {
    opacity: 1;
}

.folder-container.expanded .folder-icon {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Dynamic folder colors based on category */
.folder-icon.business-professional { 
    background: linear-gradient(135deg, #3742fa, #2f3542) !important; 
}
.folder-icon.communication { 
    background: linear-gradient(135deg, #00d2d3, #54a0ff) !important; 
}
.folder-icon.content-media { 
    background: linear-gradient(135deg, #576574, #222f3e) !important; 
}
.folder-icon.work-career { 
    background: linear-gradient(135deg, #00cec9, #00b894) !important; 
}
.folder-icon.shopping-commerce { 
    background: linear-gradient(135deg, #26de81, #20bf6b) !important; 
}
.folder-icon.organization { 
    background: linear-gradient(135deg, #ffa502, #ff6348) !important; 
}
.folder-icon.security-spam { 
    background: linear-gradient(135deg, #ff6b6b, #ee5a52) !important; 
}
.folder-icon.personal { 
    background: linear-gradient(135deg, #fd79a8, #e84393) !important; 
}
.folder-icon.sales-marketing { 
    background: linear-gradient(135deg, #0984e3, #74b9ff) !important; 
}

.folder-label {
    position: relative;
}

.folder-title-editable {
    background: transparent;
    border: none;
    color: white;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    width: 100%;
    min-width: 80px;
    outline: none;
    margin-bottom: 4px;
}

.folder-title-editable:focus {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 2px 4px;
}

.folder-content {
    position: absolute;
    top: 110px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(25px);
    border-radius: 22px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.35);
    z-index: 100;
    display: none;
    min-width: 320px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.folder-content.expanded {
    display: block;
}

.folder-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.folder-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 10px;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.folder-item:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.folder-item-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.folder-item-icon svg {
    width: 24px;
    height: 24px;
}

.folder-item-label {
    color: #2c3e50;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
}

.folder-item-count {
    font-size: 10px;
    font-weight: 600;
    color: #666;
    text-align: center;
    margin-top: 2px;
    background: rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 2px 6px;
    display: inline-block;
}

/* Icon specific colors */
.priority { background: linear-gradient(135deg, #ff4757, #ff3742); }
.payments { background: linear-gradient(135deg, #3742fa, #2f3542); }
.calendar { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.social { background: linear-gradient(135deg, #00d2d3, #54a0ff); }
.tasks { background: linear-gradient(135deg, #ffa502, #ff6348); }
.updates { background: linear-gradient(135deg, #5f27cd, #341f97); }
.spam { background: linear-gradient(135deg, #6c5ce7, #5f3dc4); }
.marketplace { background: linear-gradient(135deg, #a4b0be, #747d8c); }

/* Folder item specific colors */
.networking { background: linear-gradient(135deg, #2ed573, #1e90ff); }
.news { background: linear-gradient(135deg, #ff6b35, #f7941d); }
.pitch { background: linear-gradient(135deg, #6c5ce7, #a29bfe); }
.phishing { background: linear-gradient(135deg, #ff4757, #ff3838); }
.jobs { background: linear-gradient(135deg, #3742fa, #2f3542); }
.folder-spam { background: linear-gradient(135deg, #636e72, #2d3436); }

/* Response Container - HIDDEN */
.response-section {
    display: none !important; /* Hide API response popups */
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 15px;
    padding: 20px;
    max-width: 400px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transform: translateX(450px);
    transition: transform 0.3s ease;
    z-index: 500;
}

.response-section.active {
    transform: translateX(0);
}

.response-section h3 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 16px;
}

.response-section pre {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    font-size: 12px;
    overflow-x: auto;
    color: #2c3e50;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.close-response {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #666;
}

/* Loading States */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
    .dashboard {
        padding-top: 80px; /* Reset to normal since no extra space needed */
    }
    
    .top-bar {
        padding: 12px 15px;
    }
    
    /* Mobile adjustments for top-right controls (positioning stays the same) */
    .top-right-controls {
        top: 70px; /* Slightly adjust for mobile header height */
        right: 15px; /* Closer to edge on mobile */
        gap: 8px; /* Slightly tighter gap */
    }
    
    /* Mobile adjustments for bottom-left user info (positioning stays the same) */
    .bottom-left-user {
        bottom: 15px; /* Closer to edge on mobile */
        left: 15px; /* Closer to edge on mobile */
        padding: 8px 12px; /* Slightly smaller padding */
    }
    
    .user-email {
        font-size: 12px;
    }
    
    /* Mobile adjustments for view toggle */
    .top-right-controls .view-toggle {
        padding: 3px;
    }
    
    .top-right-controls .view-btn {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .top-right-controls .view-label {
        font-size: 12px;
        padding: 0 6px;
    }
    
    .top-right-controls .action-btn {
        padding: 6px 8px;
    }
    
    .icons-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 20px;
    }
    
    .icon {
        width: 70px;
        height: 70px;
    }
    
    .icon svg {
        width: 35px;
        height: 35px;
    }

    .header h1 {
        font-size: 2em;
    }

    .response-section {
        display: none !important; /* Hide API response popups on mobile too */
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(350px);
    }

    .response-section.active {
        display: none !important; /* Hide API response popups on mobile too */
        transform: translateY(0);
    }

    .folder-content {
        min-width: 280px;
        left: 10px;
        right: 10px;
        transform: none;
    }

    .folder-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.hidden {
    display: none !important;
}

/* iOS-style Folder Popup */
.ios-folder-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ios-folder-backdrop.show {
    opacity: 1;
}

.ios-folder-popup {
    position: fixed;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(30px);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 10001;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ios-folder-popup.show {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.ios-folder-header {
    text-align: center;
    margin-bottom: 20px;
}

.ios-folder-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    text-transform: capitalize;
}

.ios-folder-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    max-height: 300px; /* Exactly 3 rows: 3 * 100px = 300px */
    overflow-y: auto;
    overflow-x: hidden;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.ios-folder-grid::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.ios-folder-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 5px;
    cursor: pointer;
    border-radius: 12px;
    transition: background 0.2s ease;
    height: 100px; /* Increased height to accommodate labels */
    justify-content: flex-start;
}

.ios-folder-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.ios-app-icon {
    position: relative;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* iOS App Icon Color Variations */
.ios-app-icon.app-blue {
    background: linear-gradient(135deg, #007AFF, #5AC8FA);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.ios-app-icon.app-green {
    background: linear-gradient(135deg, #34C759, #30D158);
    box-shadow: 0 4px 12px rgba(52, 199, 89, 0.3);
}

.ios-app-icon.app-orange {
    background: linear-gradient(135deg, #FF9500, #FFCC02);
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.3);
}

.ios-app-icon.app-red {
    background: linear-gradient(135deg, #FF3B30, #FF6B6B);
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
}

.ios-app-icon.app-purple {
    background: linear-gradient(135deg, #AF52DE, #BF5AF2);
    box-shadow: 0 4px 12px rgba(175, 82, 222, 0.3);
}

.ios-app-icon.app-pink {
    background: linear-gradient(135deg, #FF2D92, #FF6FA3);
    box-shadow: 0 4px 12px rgba(255, 45, 146, 0.3);
}

.ios-app-icon.app-dark {
    background: linear-gradient(135deg, #1C1C1E, #2C2C2E);
    box-shadow: 0 4px 12px rgba(28, 28, 30, 0.3);
}

.ios-app-icon.app-gray {
    background: linear-gradient(135deg, #8E8E93, #AEAEB2);
    box-shadow: 0 4px 12px rgba(142, 142, 147, 0.3);
}

.ios-app-icon.app-default {
    background: linear-gradient(135deg, #667eea, #764ba2);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.ios-app-icon svg {
    width: 30px;
    height: 30px;
}

.ios-app-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff3b30;
    color: white;
    border-radius: 10px;
    min-width: 20px;
    height: 20px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.ios-app-label {
    font-size: 11px;
    color: #333;
    text-align: center;
    line-height: 1.2;
    max-width: 80px;
    min-height: 24px; /* Ensure consistent height for labels */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
    margin-top: 6px;
    font-weight: 400;
    /* Debug: Add background to see if labels are there */
    /* background: rgba(255, 0, 0, 0.1); */
}

/* AI Delegate Button Styles */
.ai-delegate-container {
    position: fixed;
    top: 80px; /* Below header */
    left: 20px;
    z-index: 1000;
    transition: all 0.5s ease; /* Slower animation */
}

/* Spinning animation for AI processing */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.ai-delegate-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%); /* Brighter teal gradient */
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.25); /* Brighter teal shadow */
    transition: all 0.5s ease; /* Slower animation */
}

.ai-delegate-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(6, 182, 212, 0.35); /* Brighter teal shadow */
}

.ai-icon {
    width: 18px;
    height: 18px;
    color: white;
}

.delegate-text {
    white-space: nowrap;
    transition: opacity 0.3s ease; /* Faster for button animation */
}

.ai-delegate-input {
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid #06b6d4; /* Brighter teal border */
    border-radius: 25px;
    padding: 8px;
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.15); /* Brighter teal shadow */
    gap: 8px;
    min-width: 450px; /* Longer desktop view */
    transition: all 0.5s ease; /* Slower animation */
}

.ai-prompt-field {
    flex: 1;
    border: none;
    outline: none;
    padding: 8px 12px;
    font-size: 14px;
    background: transparent;
    color: #374151;
}

.ai-prompt-field::placeholder {
    color: #9ca3af;
    font-style: italic;
}

.ai-submit-button {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%); /* Brighter teal gradient */
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ai-submit-button:hover {
    transform: scale(1.1);
}

.ai-submit-button svg {
    width: 16px;
    height: 16px;
    color: white;
}

/* Dark mode styles */
.dark-theme .ai-delegate-input {
    background: #1f2937;
    border-color: #06b6d4; /* Brighter teal border in dark mode */
}

.dark-theme .ai-prompt-field {
    color: #f3f4f6;
}

.dark-theme .ai-prompt-field::placeholder {
    color: #6b7280;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .ai-delegate-container {
        top: 70px; /* Below header on mobile */
        left: 15px;
        right: auto; /* Remove right constraint to keep button style */
    }
    
    .ai-delegate-input {
        min-width: 280px; /* Smaller but not full width */
        width: auto; /* Auto width instead of 100% */
    }
    
    .ai-delegate-button {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .ai-icon {
        width: 16px;
        height: 16px;
    }
}
