/* Online Notepad Tool Styles */

/* Textarea Auto-resize */
#noteContent {
    min-height: 24rem;
    max-height: none;
    transition: height 0.2s ease;
    font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
    font-size: 16px;
    line-height: 1.6;
}

/* Title Input */
#noteTitle {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    transition: all 0.2s ease;
}

#noteTitle:hover,
#noteTitle:focus {
    background-color: #f9fafb;
}

/* Save Status Animation */
.save-status-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Dropdown Menu Animations */
.menu-enter {
    animation: menuSlideIn 0.15s ease-out forwards;
}

.menu-exit {
    animation: menuSlideOut 0.1s ease-in forwards;
}

@keyframes menuSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes menuSlideOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-8px) scale(0.95);
    }
}

/* Stats Bar */
.stat-item {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0;
    color: #6b7280;
}

.stat-item strong {
    color: #374151;
    font-weight: 600;
}

/* Toolbar Buttons Hover Effects */
.toolbar-btn {
    transition: all 0.2s ease;
    transform: translateY(0);
}

.toolbar-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.toolbar-btn:active {
    transform: translateY(0);
}

/* Format and Export Menu Items */
.format-option,
.export-option {
    transition: all 0.15s ease;
    position: relative;
}

.format-option:hover,
.export-option:hover {
    background-color: #f3f4f6;
    padding-left: 1.25rem;
}

.format-option:active,
.export-option:active {
    background-color: #e5e7eb;
}

/* Modal Overlay Animation */
#confirmModal {
    backdrop-filter: blur(4px);
    animation: modalFadeIn 0.2s ease-out;
}

#confirmModal.hidden {
    animation: modalFadeOut 0.15s ease-in;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

#confirmModal > div {
    animation: modalSlideIn 0.2s ease-out;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Success Toast Animation */
#successToast {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

#successToast:not(.translate-x-full) {
    animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Editor Focus Styles */
#noteContent:focus {
    outline: none;
    box-shadow: 0 0 0 1px #3b82f6;
}

/* Responsive Improvements */
@media (max-width: 640px) {
    /* Mobile toolbar adjustments */
    .toolbar-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Smaller buttons on mobile */
    .toolbar-btn {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }

    /* Full width menus on mobile */
    #formatMenu,
    #exportMenu {
        left: 0;
        right: 0;
        width: auto;
        margin: 0.5rem;
    }

    /* Adjust stats display on mobile */
    .stat-item {
        font-size: 0.875rem;
        margin-bottom: 0.25rem;
    }

    /* Smaller modal on mobile */
    #confirmModal > div {
        margin: 1rem;
        max-width: calc(100vw - 2rem);
    }
}

@media (max-width: 480px) {
    /* Extra small screens */
    #noteContent {
        font-size: 14px;
        min-height: 20rem;
    }

    .toolbar-actions {
        flex-wrap: wrap;
    }

    .toolbar-btn {
        flex: 1;
        min-width: 120px;
    }
}

/* Print Styles */
@media print {
    .toolbar,
    .stats-bar,
    #saveStatus,
    button {
        display: none !important;
    }

    #noteContent {
        border: none !important;
        box-shadow: none !important;
        font-size: 12pt;
        line-height: 1.5;
    }

    body {
        background: white !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    #noteContent {
        border: 2px solid #000;
    }

    .stat-item {
        font-weight: 600;
    }

    button {
        border: 2px solid;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Custom Scrollbar for Textarea */
#noteContent::-webkit-scrollbar {
    width: 8px;
}

#noteContent::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 4px;
}

#noteContent::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

#noteContent::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Selection Styling */
#noteContent::selection {
    background: #3b82f6;
    color: white;
}

#noteContent::-moz-selection {
    background: #3b82f6;
    color: white;
}

/* Placeholder Styling */
#noteContent::placeholder {
    color: #9ca3af;
    font-style: italic;
}

#noteTitle::placeholder {
    color: #9ca3af;
    font-style: italic;
}

/* Loading State for Buttons */
.btn-loading {
    position: relative;
    color: transparent;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Feature Cards Hover Effect */
.feature-card {
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Word Count Highlighting */
.word-count-milestone {
    position: relative;
}

.word-count-milestone::after {
    content: "🎉";
    position: absolute;
    right: -20px;
    animation: bounce 0.6s ease-in-out;
}

@keyframes bounce {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Accessibility Improvements */
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Dark Mode Preparation (if needed in future) */
[data-theme="dark"] {
    /* Dark mode styles would go here if needed in the future */
    /* Currently using light theme only as requested */
}
