/* Text Editor Styles */

/* Main Container - Full Page Layout */
.text-editor-tool {
    width: 100%;
    min-height: 100vh;
    background: #ffffff;
    padding: 0;
    margin: 0;
    position: relative;
}

.text-editor-tool::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.02) 0%, rgba(118, 75, 162, 0.02) 50%, rgba(240, 147, 251, 0.02) 100%);
}

.tool-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* Tool Header */
.tool-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.tool-header h1 {
    font-size: 3rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 1.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    letter-spacing: -0.02em;
}

.tool-header h1 i {
    color: #667eea;
    margin-right: 0.75rem;
    filter: drop-shadow(0 2px 4px rgba(102, 126, 234, 0.2));
}

.tool-description {
    font-size: 1.125rem;
    color: #475569;
    max-width: 900px;
    margin: 0 auto;
    line-height: 1.7;
    font-weight: 400;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

/* Editor Interface */
.editor-interface {
    background: var(--white);
    border-radius: 20px;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(226, 232, 240, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, 0.3);
    position: relative;
}

.editor-interface::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.2), transparent);
}

.editor-card {
    display: flex;
    flex-direction: column;
    height: 80vh;
    min-height: 600px;
    background: #ffffff;
}

/* Toolbar */
.editor-toolbar {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    flex-wrap: wrap;
    gap: 0.75rem;
    position: relative;
}

.editor-toolbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.3), transparent);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(226, 232, 240, 0.4);
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 10px;
    color: #475569;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.875rem;
    position: relative;
    overflow: hidden;
}

.toolbar-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 10px;
}

.toolbar-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.toolbar-btn:hover::before {
    opacity: 0.1;
}

.toolbar-btn:active,
.toolbar-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white);
    border-color: transparent;
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.toolbar-btn:active::before,
.toolbar-btn.active::before {
    opacity: 0;
}

.toolbar-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.toolbar-btn:disabled:hover {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

.toolbar-separator {
    width: 1px;
    height: 28px;
    background: linear-gradient(to bottom, transparent, rgba(148, 163, 184, 0.5), transparent);
    margin: 0 0.5rem;
}

.toolbar-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: #475569;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 120px;
    backdrop-filter: blur(10px);
}

.toolbar-select:hover {
    border-color: rgba(102, 126, 234, 0.4);
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.toolbar-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: rgba(255, 255, 255, 1);
}

/* Color Picker Group */
.color-picker-group {
    position: relative;
}

.color-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.color-label:hover {
    border-color: rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    background: rgba(255, 255, 255, 1);
}

.color-label i {
    font-size: 0.875rem;
    color: #475569;
    z-index: 2;
    position: relative;
    transition: color 0.3s ease;
}

.color-label:hover i {
    color: #667eea;
}

.color-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
}

/* Find and Replace Panel */
.find-replace-panel {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.02) 0%, rgba(118, 75, 162, 0.02) 100%);
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    padding: 1.5rem;
    position: relative;
}

.find-replace-panel::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.3), transparent);
}

.find-replace-content {
    max-width: 800px;
    margin: 0 auto;
}

.find-replace-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.find-replace-row:last-child {
    margin-bottom: 0;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-color);
    min-width: 60px;
}

.find-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 12px;
    font-size: 0.875rem;
    background: rgba(255, 255, 255, 0.9);
    color: #334155;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.find-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
}

.find-btn,
.replace-btn {
    padding: 0.75rem 1rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: #475569;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.find-btn:hover,
.replace-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white);
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.find-options {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-color);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin: 0;
}

.checkmark {
    width: 16px;
    height: 16px;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    position: relative;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--white);
    font-size: 10px;
}

.find-results {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-left: auto;
}

.close-find-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.close-find-btn:hover {
    background: var(--bg-light);
    color: var(--text-color);
}

/* Editor Content */
.editor-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.editor-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.editor-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 2rem;
    right: 2rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.2), transparent);
    z-index: 1;
}

.editor-area {
    flex: 1;
    padding: 3rem;
    border: none;
    outline: none;
    font-family: 'Georgia', serif;
    font-size: 16px;
    line-height: 1.8;
    color: #334155;
    background: #ffffff;
    overflow-y: auto;
    resize: none;
    min-height: 400px;
    position: relative;
}

.editor-area:empty::before {
    content: attr(data-placeholder);
    color: #94a3b8;
    font-style: italic;
    font-weight: 300;
    opacity: 0.8;
}

.editor-area:focus {
    outline: none;
    background: #ffffff;
}

/* Enhanced text styling within editor */
.editor-area p {
    margin-bottom: 1em;
}

.editor-area h1, .editor-area h2, .editor-area h3 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
}

.editor-area ul, .editor-area ol {
    margin: 1em 0;
    padding-left: 2em;
}

.editor-area li {
    margin-bottom: 0.5em;
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-top: 1px solid rgba(226, 232, 240, 0.6);
    font-size: 0.875rem;
    color: #64748b;
    position: relative;
}

.status-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.3), transparent);
}

.status-left,
.status-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    font-weight: 500;
}

.status-item:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.status-item i {
    font-size: 0.75rem;
    color: #667eea;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(8px);
    }
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.02) 0%, rgba(118, 75, 162, 0.02) 100%);
    border-radius: 20px 20px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #334155;
}

.modal-header h3 i {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-right: 0.75rem;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(255, 255, 255, 0.9);
    color: #64748b;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.modal-body {
    padding: 1.5rem;
}

/* Export Options */
.export-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.export-option {
    width: 100%;
}

.export-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    color: #334155;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.export-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.export-btn:hover {
    border-color: rgba(102, 126, 234, 0.4);
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.export-btn:hover::before {
    opacity: 0.05;
}

.export-btn i {
    font-size: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    z-index: 2;
    position: relative;
}

.export-btn span {
    font-weight: 600;
    font-size: 1.125rem;
    z-index: 2;
    position: relative;
}

.export-btn small {
    color: #64748b;
    font-size: 0.875rem;
    z-index: 2;
    position: relative;
}

/* Full Screen Mode */
.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999;
    background: #ffffff;
    animation: fullscreenFadeIn 0.3s ease-out;
}

@keyframes fullscreenFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.fullscreen-mode .editor-card {
    height: 100vh;
    border-radius: 0;
}

.fullscreen-mode .tool-header {
    display: none;
}

.fullscreen-mode .editor-interface {
    border-radius: 0;
    box-shadow: none;
    border: none;
}

/* Enhanced scrollbar styling */
.editor-area::-webkit-scrollbar {
    width: 8px;
}

.editor-area::-webkit-scrollbar-track {
    background: rgba(148, 163, 184, 0.1);
    border-radius: 4px;
}

.editor-area::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: background 0.3s ease;
}

.editor-area::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

/* Loading animation for buttons */
@keyframes buttonPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.toolbar-btn:active {
    animation: buttonPulse 0.2s ease-in-out;
}

/* Highlight animation for search results */
@keyframes highlightPulse {
    0%, 100% {
        background-color: yellow;
    }
    50% {
        background-color: orange;
    }
}

.editor-area mark {
    animation: highlightPulse 1s ease-in-out infinite;
    border-radius: 3px;
    padding: 1px 2px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tool-container {
        padding: 1rem;
    }

    .tool-header h1 {
        font-size: 2.5rem;
    }

    .tool-description {
        font-size: 1rem;
        padding: 0 1rem;
    }

    .editor-toolbar {
        padding: 0.75rem;
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .toolbar-group {
        gap: 0.25rem;
        padding: 0.125rem;
    }

    .toolbar-btn {
        width: 32px;
        height: 32px;
    }

    .toolbar-select {
        min-width: 100px;
        font-size: 0.8rem;
    }

    .toolbar-separator {
        display: none;
    }

    .editor-area {
        padding: 1.5rem;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .status-bar {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
        padding: 1rem;
    }

    .status-left,
    .status-right {
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .status-item {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }

    .find-replace-panel {
        padding: 1rem;
    }

    .find-replace-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .input-group {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .input-group label {
        min-width: auto;
        font-weight: 600;
    }

    .find-input {
        padding: 0.75rem;
    }

    .find-btn,
    .replace-btn {
        padding: 0.75rem;
        width: 100%;
    }

    .modal-content {
        width: 95%;
        margin: 1rem;
    }

    .modal-header {
        padding: 1rem 1.5rem;
    }

    .modal-header h3 {
        font-size: 1.25rem;
    }

    .export-btn {
        padding: 1rem;
        gap: 1rem;
    }

    .export-btn i {
        font-size: 1.5rem;
    }

    .export-btn span {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .tool-header h1 {
        font-size: 2rem;
    }

    .editor-card {
        height: 70vh;
        min-height: 500px;
    }

    .editor-area {
        padding: 1rem;
    }

    .toolbar-group {
        flex-wrap: wrap;
    }

    .status-left,
    .status-right {
        width: 100%;
        justify-content: space-between;
    }
}
