* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
} /* Reset default margin, padding, and box-sizing for all elements */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
} /* Fade-in animation for elements */

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

body {
    font-family: 'Roboto', sans-serif;
    transition: background-color 0.3s, color 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
    background-color: #ffffff;
} /* Main body styles: font, centering, background */

.grid-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -2;
    background-image:
        linear-gradient(to right, rgba(0, 0, 0, 0.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
} /* Subtle grid background for visual interest */

body.dark-mode .grid-background {
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
} /* Grid background for dark mode */

@keyframes slideIn {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 0.3;
    }
} /* Slide-in animation for overlays */

body.light-mode {
    color: #333;
} /* Text color for light mode */

body.dark-mode {
    background-color: #000000;
    color: #ffffff;
} /* Background and text color for dark mode */

.container {
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 800px;
    width: 100%;
    backdrop-filter: blur(10px);
    animation: fadeInUp 0.8s ease-out; 
    transition: transform 0.3s ease;
    position: relative;
    overflow: hidden;
} /* Main content container styles */

.container:hover {
    transform: translateY(-5px);
} /* Slight lift on hover for container */

.light-mode .container {
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
} /* Container background for light mode */

.dark-mode .container {
    background-color: rgba(0, 0, 0, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
} /* Container background for dark mode */

h1,
h3 {
    text-align: center;
    margin-bottom: 1rem;
    animation: fadeIn 0.6s ease-out;
} /* Centered headings with fade-in */

h1 {
    font-size: 2.5rem;
    background: linear-gradient(45deg, #2196F3, #4CAF50);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 2rem;
} /* Gradient text for main title */

.input-area,
.output-area {
    margin-bottom: 1.5rem;
    animation: fadeIn 0.6s ease-out;
} /* Spacing and animation for input/output areas */

textarea {
    width: 100%;
    padding: 1rem;
    border-radius: 8px;
    resize: vertical;
    min-height: 100px;
    transition: all 0.3s ease;
    font-size: 1rem;
    line-height: 1.5;
    will-change: transform;
} /* Main textarea styles */

textarea:focus {
    outline: none;
    transform: scale(1.01);
} /* Slight scale on focus for textarea */

.light-mode textarea {
    background-color: white;
    color: #333;
    border: 1px solid #ccc;
} /* Textarea styles for light mode */

.dark-mode textarea {
    background-color: #000000;
    color: #ffffff;
    border: 1px solid #333;
} /* Textarea styles for dark mode */

#dropzone {
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.6s ease-out;
} /* Drag-and-drop area styles */

.light-mode #dropzone {
    border: 2px dashed #ccc;
    background-color: rgba(255, 255, 255, 0.5);
} /* Dropzone for light mode */

.dark-mode #dropzone {
    border: 2px dashed #555;
    background-color: rgba(45, 45, 45, 0.5);
} /* Dropzone for dark mode */

#dropzone:hover {
    transform: scale(1.02);
} /* Slight scale on hover for dropzone */

#dropzone.dragover {
    transform: scale(1.05);
    border-color: #2196F3;
} /* Highlight dropzone on dragover */

button {
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
} /* Main button styles */

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
} /* Button hover effect */

button:active {
    transform: translateY(0);
} /* Button active effect */

#decrypt {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    width: 100%;
    margin-bottom: 1.5rem;
} /* Decrypt button styles */

#mode-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.8rem;
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 12px;
    width: 46px;
    height: 46px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
} /* Theme toggle button styles */

.light-mode #mode-toggle {
    color: #333;
    background-color: rgba(0, 0, 0, 0.1);
} /* Mode toggle for light mode */

.dark-mode #mode-toggle {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #f0f0f0;
} /* Mode toggle for dark mode */

#mode-toggle:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.15);
} /* Mode toggle hover effect */

#result {
    margin: 1rem 0;
    padding: 1rem;
    border-radius: 8px;
    animation: fadeIn 0.6s ease-out;
} /* Result message area styles */

.success {
    background-color: rgba(76, 175, 80, 0.1);
    border: 1px solid #4CAF50;
} /* Success message styles */

.error {
    background-color: rgba(244, 67, 54, 0.1);
    border: 1px solid #f44336;
} /* Error message styles */

@keyframes spin {
    to { transform: rotate(360deg); }
} /* Spinner animation */

.loading {
    display: none;
    text-align: center;
    margin: 1rem 0;
} /* Loading spinner container */

.loading::after {
    content: '';
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #ccc;
    border-radius: 50%;
    border-top-color: #2196F3;
    animation: spin 1s linear infinite;
} /* Spinner element */

.results-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1.5rem;
    border-radius: 8px;
    overflow: hidden;
    animation: fadeIn 0.6s ease-out;
} /* Results table styles */

.results-table th,
.results-table td {
    padding: 1rem;
    text-align: left;
    transition: all 0.3s ease;
} /* Table cell styles */

.results-table th {
    font-weight: 600;
} /* Table header styles */

.results-table th:first-child {
    border-top-left-radius: 8px;
} /* Rounded left header */

.results-table th:last-child {
    border-top-right-radius: 8px;
} /* Rounded right header */

.light-mode .results-table th {
    background-color: #f5f5f5;
    border-bottom: 2px solid #eee;
} /* Table header for light mode */

.dark-mode .results-table th {
    background-color: #000000;
    border-bottom: 2px solid #333;
} /* Table header for dark mode */

.results-table tr {
    transition: all 0.3s ease;
} /* Table row transition */

.results-table tr:hover {
    transform: translateX(5px);
} /* Table row hover effect */

.results-table tr.selected {
    background-color: rgba(248, 226, 226, 0.136);
} /* Selected row style */

.high-confidence {
    background-color: rgba(76, 175, 80, 0.1);
    border-left: 4px solid #4CAF50;
} /* High confidence row */

.low-confidence {
    background-color: rgba(255, 68, 68, 0.1);
    border-left: 4px solid #ff4444;
} /* Low confidence row */

.valid-word {
    text-decoration: underline;
    text-decoration-color: #4CAF50;
    text-decoration-thickness: 2px;
} /* Underline for valid words */

.copied {
    background-color: rgba(33, 150, 243, 0.2) !important;
    transition: background-color 0.3s ease;
} /* Row highlight when copied */

#download {
    background: linear-gradient(45deg, #2196F3, #1976D2);
    margin-top: 1rem;
} /* Download button styles */

.table-comment {
    margin-top: 1rem;
    font-style: italic;
    text-align: center;
    opacity: 0.8;
} /* Table comment style */

@media (max-width: 768px) {
    .container {
        padding: 1.5rem;
    }
    h1 {
        font-size: 2rem;
    }
    button {
        padding: 0.6rem 1.2rem;
    }
} /* Responsive styles for mobile */

.info-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: linear-gradient(45deg, #3f5efb, #fc466b);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    margin-left: 8px;
    border: none;
    font-size: 14px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
} /* Info button styles */

.info-button:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(63, 94, 251, 0.5);
} /* Info button hover effect */

.info-window {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(18, 18, 18, 0.95);
    padding: 24px;
    border-radius: 8px;
    z-index: 1000;
    max-width: 800px;
    width: 100%;
    border: 1px solid rgba(63, 94, 251, 0.2);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
} /* Info window styles */

.info-window.active {
    display: block;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
} /* Active info window */

.info-window-content {
    margin-bottom: 20px;
    color: #fff;
    text-align: center;
} /* Info window content */

.info-window-content ol {
    list-style-position: inside;
    padding-left: 0;
    margin: 1rem 0;
} /* Info window list */

.info-window-content li {
    margin: 0.5rem 0;
    text-align: left;
    display: inline-block;
    text-align: left;
} /* Info window list item */

.info-window h4 {
    color: #3f5efb;
    margin-bottom: 16px;
    font-size: 1.25rem;
} /* Info window heading */

.info-window p, .info-window li {
    color: #a0a0a0;
    line-height: 1.6;
} /* Info window text */

.close-button {
    display: block;
    margin: 0 auto;
    padding: 8px 16px;
    background: linear-gradient(45deg, #3f5efb, #fc466b);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
} /* Close button for info window */

.close-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(63, 94, 251, 0.4);
} /* Close button hover */

.container {
    animation: fadeInUp 0.8s ease-out;
} /* Container fade-in animation */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
} /* Fade-in up animation */

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
} /* Overlay for info window */

.overlay.active {
    opacity: 1;
    pointer-events: all;
} /* Active overlay */
