* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    transition: all 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    backdrop-filter: blur(10px);
    min-height: calc(100vh - 20px);
    display: flex;
    flex-direction: column;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.header p {
    opacity: 0.9;
    font-size: 1.1rem;
}

.toolbar {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.toolbar-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

select {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 12px;
    background: white;
}

.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.editor-header {
    background: #f8f9fa;
    padding: 10px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #6c757d;
}

.document-info span {
    margin-right: 15px;
}

.word-count {
    font-weight: 500;
}

#notepad {
    flex: 1;
    width: 100%;
    border: none;
    padding: 30px;
    font-family: 'Georgia', serif;
    font-size: 14px;
    line-height: 1.8;
    resize: none;
    background: #fff;
    color: #333;
    outline: none;
    min-height: 500px;
}

#notepad:focus {
    background: #fafafa;
}

.footer {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.status-bar {
    padding: 8px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: #6c757d;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 10% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 30px;
}

.search-group {
    margin-bottom: 20px;
}

.search-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.search-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.search-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.search-buttons .btn {
    flex: 1;
}

/* Loading Indicator */
.loading {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    text-align: center;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Dark Theme */
.dark-theme {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
}

.dark-theme .container {
    background: rgba(45, 55, 72, 0.95);
    color: #e2e8f0;
}

.dark-theme .toolbar,
.dark-theme .editor-header,
.dark-theme .footer {
    background: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
}

.dark-theme .line-numbers {
    background: #4a5568;
    color: #a0aec0;
    border-right-color: #718096;
    box-shadow: inset -1px 0 0 #718096;
}

.dark-theme #notepad {
    background: #2d3748;
    color: #e2e8f0;
}

.dark-theme #notepad:focus {
    background: #4a5568;
}

.dark-theme select {
    background: #4a5568;
    color: #e2e8f0;
    border-color: #718096;
}

.dark-theme .modal-content {
    background: #2d3748;
    color: #e2e8f0;
}

.dark-theme .modal-body input {
    background: #4a5568;
    color: #e2e8f0;
    border-color: #718096;
}

.dark-theme .loading {
    background: #2d3748;
    color: #e2e8f0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        gap: 10px;
    }
    
    .toolbar-right {
        width: 100%;
        justify-content: center;
    }
    
    .editor-header {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
    
    .editor-with-numbers {
        flex-direction: column;
    }
    
    .line-numbers {
        display: none; /* Hide line numbers on mobile for better space */
    }
    
    #notepad {
        width: 100%;
        padding: 20px;
        font-size: 16px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .search-buttons {
        flex-direction: column;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }
    
    .container {
        box-shadow: none;
        background: white;
        border-radius: 0;
    }
    
    .header,
    .toolbar,
    .editor-header,
    .footer {
        display: none;
    }
    
    #notepad {
        border: none;
        padding: 20px;
        font-family: 'Times New Roman', serif;
        font-size: 12pt;
        line-height: 1.6;
        color: black;
        background: white;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.dark-theme ::-webkit-scrollbar-track {
    background: #4a5568;
}

.dark-theme ::-webkit-scrollbar-thumb {
    background: #718096;
}

.dark-theme ::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}