/*  style.css */
/*  style.css */

/* Font */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ===== AUTHENTICATION STYLES ===== */

/* Authentication Page */
.auth-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-content {
    background: white;
    border-radius: 16px;
    padding: 3rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 400px;
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.dark .auth-content {
    background: #1f2937;
    color: white;
    border-color: #374151;
}

/* Enhanced text contrast for auth page */
.auth-content h1 {
    color: #1e293b !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.auth-content p {
    color: #334155 !important;
}

.dark .auth-content h1 {
    color: #f8fafc !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.dark .auth-content p {
    color: #e2e8f0 !important;
}

/* Google Sign-In Button Styling */
.g_id_signin {
    margin: 0 auto;
    display: flex;
    justify-content: center;
}

/* User Profile */
#user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.dark #user-profile {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
}

#user-avatar {
    flex-shrink: 0;
}

#user-name {
    font-weight: 500;
    color: #374151;
}

.dark #user-name {
    color: #e5e7eb;
}

/* Loading States */
.loading-spinner {
    border-color: #e5e7eb;
    border-top-color: #3b82f6;
}

/* ===== READ-ONLY COMPLETED NOTES STYLES ===== */

/* Read-only states for completed notes */
.note-card.completed [contenteditable] {
    background-color: #f8fafc !important;
    border-color: #e2e8f0 !important;
    color: #64748b !important;
    cursor: not-allowed;
    user-select: none;
    pointer-events: none;
}

.dark .note-card.completed [contenteditable] {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #64748b !important;
}

.note-card.completed input,
.note-card.completed textarea {
    background-color: #f8fafc !important;
    border-color: #e2e8f0 !important;
    color: #64748b !important;
    cursor: not-allowed;
    pointer-events: none;
}

.dark .note-card.completed input,
.dark .note-card.completed textarea {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #64748b !important;
}

/* Hide action buttons for completed notes */
.note-card.completed .save-btn,
.note-card.completed .move-up-btn,
.note-card.completed .move-down-btn,
.note-card.completed .delete-btn {
    display: none !important;
}

/* Show readonly indicator for completed notes */
.note-card.completed .readonly-indicator {
    display: block !important;
}

/* Traffic light remains interactive for completed notes */
.note-card.completed .traffic-light {
    cursor: pointer !important;
    pointer-events: auto !important;
}

/* Completed note visual distinction */
.note-card.completed {
    background-color: #fafafa;
    border-color: #e5e7eb;
    opacity: 0.85;
}

.dark .note-card.completed {
    background-color: #1f2937;
    border-color: #374151;
}

/* Readonly indicator styling */
.readonly-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    background: rgba(245, 158, 11, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.dark .readonly-indicator {
    background: rgba(245, 158, 11, 0.2);
}

/* ===== EXISTING STYLES (Enhanced) ===== */

/* Note Header Layout */
.note-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    min-width: 0;
}

.note-header .flex-1 {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.note-title {
    line-height: 1.4;
    min-height: 1.4em;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    white-space: pre-wrap;
}

/* Alternative truncation for extremely long single words */
.note-title.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Note Metadata */
.note-metadata {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 11px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    line-height: 1.3;
    margin-top: 2px;
}

.note-card:hover .note-metadata {
    opacity: 1;
}

.note-order {
    font-weight: 600;
    color: #3b82f6;
}

.dark .note-order {
    color: #60a5fa;
}

/* Contenteditable Styling */
[contenteditable] {
    transition: all 0.2s ease;
}

[contenteditable]:hover {
    background-color: rgba(59, 130, 246, 0.05);
}

[contenteditable]:focus {
    background-color: rgba(59, 130, 246, 0.1);
    outline: none;
}

/* Placeholder Text */
.placeholder-text {
    color: #9ca3af !important;
    font-style: italic;
    opacity: 0.8;
}

.dark .placeholder-text {
    color: #6b7280 !important;
}

/* Traffic Light States */
.traffic-light {
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-top: 2px;
}

.traffic-light:hover {
    transform: scale(1.15);
}

.traffic-light:active {
    transform: scale(0.9);
}

/* Active (Yellow) State */
.traffic-light.active {
    background-color: #fbbf24;
    border-color: #f59e0b;
}

.traffic-light.active:hover {
    background-color: #f59e0b;
}

.traffic-light.active:focus {
    ring-color: #f59e0b;
}

/* Completed (Green) State */
.traffic-light.completed {
    background-color: #10b981;
    border-color: #059669;
}

.traffic-light.completed:hover {
    background-color: #059669;
}

.traffic-light.completed:focus {
    ring-color: #059669;
}

/* Enhanced Completed Note Styling */
.note-card.completed .note-title {
    text-decoration: line-through;
    color: #6b7280;
}

.dark .note-card.completed .note-title {
    color: #4b5563;
}

/* Note Body Expand/Collapse */
.note-body {
    display: none;
    animation: slideDown 0.3s ease;
}

.note-body.expanded {
    display: block;
}

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

/* Expand Button States */
.expand-btn {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 14px;
    line-height: 1;
    user-select: none;
    transition: all 0.2s ease;
}

.expand-btn:hover {
    transform: scale(1.2);
}

.expand-btn:active {
    transform: scale(0.9);
}

/* Save Button States */
.save-btn {
    transition: all 0.2s ease;
}

.save-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.save-btn:active {
    transform: translateY(0);
}

/* Save Indicator */
.save-indicator {
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.save-indicator.show {
    opacity: 1 !important;
}

/* Control Buttons */
.controls {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 2px;
}

.controls button {
    transition: all 0.2s ease;
    border-radius: 4px;
}

.controls button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.dark .controls button:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.controls button:active {
    transform: scale(0.95);
}

/* Move Buttons */
.move-up-btn:hover {
    background-color: rgba(34, 197, 94, 0.1);
}

.move-down-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

/* Delete Button */
.delete-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

/* Note Card Animations */
.note-card {
    transition: all 0.3s ease;
}

.note-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.dark .note-card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* Status Message */
#status-message {
    transition: all 0.3s ease;
    font-weight: 500;
}

#status-message.success {
    color: #10b981;
}

#status-message.error {
    color: #ef4444;
}

#status-message.warning {
    color: #f59e0b;
}

#status-message.info {
    color: #3b82f6;
}

/* Modal */
#modal-overlay {
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
}

#modal-overlay.show {
    display: flex !important;
}

/* Form Fields */
input, textarea, [contenteditable] {
    transition: all 0.2s ease;
}

input:focus, textarea:focus, [contenteditable]:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark ::-webkit-scrollbar-track {
    background: #1e293b;
}

.dark ::-webkit-scrollbar-thumb {
    background: #475569;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Enhanced Responsive Design */
@media (max-width: 640px) {
    .auth-content {
        padding: 2rem;
        margin: 1rem;
    }
    
    .note-header {
        flex-direction: column;
        gap: 8px;
    }
    
    .note-header .flex-1 {
        width: 100%;
        min-width: 0;
    }
    
    .note-title {
        font-size: 16px;
        line-height: 1.3;
        padding: 8px;
    }
    
    .controls {
        flex-wrap: wrap;
        gap: 4px;
        width: 100%;
        justify-content: flex-end;
    }
    
    .controls button {
        min-width: 32px;
        font-size: 12px;
    }
    
    
    .note-metadata {
        font-size: 10px;
    }
    
    .traffic-light {
        width: 24px;
        height: 24px;
        align-self: flex-start;
        margin-top: 2px;
    }
    
    #user-profile {
        gap: 8px;
        padding: 6px 12px;
    }
    
    #user-name {
        font-size: 14px;
    }
    
    .readonly-indicator {
        font-size: 11px;
        padding: 1px 6px;
    }
}

/* Focus Indicators for Accessibility */
button:focus, input:focus, textarea:focus, [contenteditable]:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Smooth Transitions */
* {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced Authentication Loading */
#auth-loading {
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Print Styles */
@media print {
    .controls, #add-note-btn, #search-input, #search-btn, #clear-search-btn, #user-profile {
        display: none !important;
    }
    
    .note-body {
        display: block !important;
    }
    
    .note-card {
        break-inside: avoid;
        margin-bottom: 16px;
    }
    
    .readonly-indicator {
        background: #f3f4f6 !important;
        color: #374151 !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .traffic-light {
        border-width: 3px;
    }
    
    .note-card {
        border-width: 2px;
    }
    
    .readonly-indicator {
        border: 1px solid #d97706;
    }
}

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

/* Dark mode enhancements for authentication */
.dark .auth-page {
    background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 100%);
}

/* Enhanced user experience for readonly notes */
.note-card.completed:hover .readonly-indicator {
    background: rgba(245, 158, 11, 0.2);
    transform: scale(1.02);
}

.dark .note-card.completed:hover .readonly-indicator {
    background: rgba(245, 158, 11, 0.3);
}