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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

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

.title-bar h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.reload-btn {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reload-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.reload-btn:active {
    transform: scale(0.95);
}

.add-btn {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.notes-container {
    padding: 1rem;
}

.note-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 1rem;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: visible;
    touch-action: pan-y;
    height: auto;
    min-height: auto;
}

.note-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.note-item.deleting {
    transform: translateX(-100%);
    opacity: 0;
}

.note-item.updating {
    opacity: 0.7;
    pointer-events: none;
}

.note-item.updating::after {
    content: 'Saving...';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.75rem;
    color: #667eea;
    font-weight: 600;
}

.note-content {
    width: 100%;
    min-height: 60px;
    max-height: none;
    border: none;
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    background: transparent;
    color: #333;
    height: auto;
    overflow: visible;
    word-wrap: break-word;
    white-space: pre-wrap;
    
    /* Prevent Safari password autofill */
    -webkit-text-security: none;
    -webkit-appearance: none;
}

.note-content:focus {
    background: #f8f9fa;
    border-radius: 4px;
    padding: 0.5rem;
    margin: -0.5rem;
}

/* Prevent Safari from showing password autofill suggestions */
.note-content::-webkit-credentials-auto-fill-button {
    display: none !important;
}

.note-content::-webkit-credentials-auto-fill-button:hover {
    display: none !important;
}

.note-timestamp {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.5rem;
    text-align: right;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.empty-state h3 {
    margin-bottom: 1rem;
    color: #999;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .app-container {
        margin: 0;
        box-shadow: none;
    }
    
    .title-bar {
        padding: 1rem;
    }
    
    .notes-container {
        padding: 0.5rem;
    }
    
    .note-item {
        margin-bottom: 0.5rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
        /* Prevent text selection on mobile */
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    .note-content {
        /* Allow text selection only within textarea */
        -webkit-user-select: text;
        -moz-user-select: text;
        -ms-user-select: text;
        user-select: text;
        /* Prevent zoom on focus */
        font-size: 16px;
        /* Improve touch targets */
        min-height: 44px;
        padding: 0.75rem;
        /* Ensure full expansion on mobile */
        max-height: none;
        height: auto;
        overflow: visible;
        word-wrap: break-word;
        white-space: pre-wrap;
    }
}

/* PWA specific styles */
@media (display-mode: standalone) {
    .app-container {
        max-width: none;
        margin: 0;
    }
}

/* Loading animation */
.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s ease-in-out infinite;
    margin-left: 0.5rem;
}

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

.settings-btn {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.settings-modal-content {
    background: #fff;
    padding: 2rem 1.5rem 1.5rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 32px rgba(0,0,0,0.18);
    min-width: 320px;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.settings-modal-content h2 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
    color: #333;
}

.setting-group {
    margin-bottom: 1.5rem;
}

.setting-group label {
    font-size: 1rem;
    color: #555;
    margin-bottom: 0.25rem;
    display: block;
}

.setting-group input {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    width: 100%;
    margin-bottom: 0.25rem;
}

.setting-group small {
    font-size: 0.875rem;
    color: #666;
    display: block;
}

#api-key-input {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    width: 100%;
    margin-bottom: 1rem;
}

.settings-modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.settings-modal-actions button {
    padding: 0.5rem 1.2rem;
    border: none;
    border-radius: 6px;
    background: #667eea;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.settings-modal-actions button:hover {
    background: #764ba2;
}

/* PWA Install Button */
.install-btn {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.5rem;
}

.install-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

/* Status Messages */
.status-message {
    padding: 0.75rem 1rem;
    margin: 0;
    text-align: center;
    font-weight: 500;
    animation: slideDown 0.3s ease-out;
    position: relative;
    z-index: 100;
}

.status-success {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.status-warning {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
}

.status-info {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
}

.status-error {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* PWA Standalone Mode Enhancements */
@media (display-mode: standalone) {
    .app-container {
        max-width: none;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }
    
    .title-bar {
        padding: 1.5rem 1rem 1rem 1rem;
        /* Add safe area padding for notched devices */
        padding-top: max(1.5rem, env(safe-area-inset-top));
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    .notes-container {
        padding: 0.5rem;
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    }
    
    /* Hide browser UI elements in standalone mode */
    body {
        overscroll-behavior: none;
        -webkit-overflow-scrolling: touch;
    }
}

/* Offline indicator */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #f44336;
    color: white;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.875rem;
    z-index: 1000;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.offline-indicator.show {
    transform: translateY(0);
}

/* Install prompt styling */
.install-prompt {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideUp 0.3s ease-out;
}

.install-prompt button {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
}

.install-prompt button:hover {
    background: #45a049;
}

.install-prompt .close-btn {
    background: transparent;
    color: #ccc;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Touch-friendly improvements for PWA */
@media (hover: none) and (pointer: coarse) {
    .note-content {
        min-height: 60px;
        padding: 1rem;
    }
    
    .add-btn, .reload-btn, .settings-btn, .install-btn {
        min-width: 48px;
        min-height: 48px;
    }
    
    .header-buttons {
        gap: 0.75rem;
    }
} 