/* Color Palette: Black (#1a1a1a), Red (#c41e3a), Light Gray (#e8e8e8), Dark Gray (#4a4a4a), White (#ffffff) */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #e8e8e8;
    min-height: 100vh;
    padding: 20px;
    color: #1a1a1a;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }
}

/* Main Navigation */
.main-nav {
    background: #1a1a1a;
    padding: 15px 30px;
    margin: -40px -40px 30px -40px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    border-bottom: 3px solid #c41e3a;
}

@media (max-width: 768px) {
    .main-nav {
        padding: 12px 20px;
        margin: -30px -30px 20px -30px;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .main-nav {
        padding: 10px 15px;
        margin: -20px -20px 15px -20px;
        gap: 8px;
    }
}

.main-nav a {
    color: #ffffff;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.9em;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .main-nav a {
        padding: 6px 12px;
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    .main-nav a {
        padding: 5px 10px;
        font-size: 0.8em;
        letter-spacing: 0.3px;
    }
}

.main-nav a:hover {
    background: #c41e3a;
    color: #ffffff;
}

.main-nav a.active {
    background: #c41e3a;
    color: #ffffff;
}

/* Container */
.container {
    background: #ffffff;
    border-radius: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 95vw;
    width: 100%;
    margin: 0 auto;
    padding: 40px;
    border: 1px solid #1a1a1a;
}

@media (min-width: 1600px) {
    .container {
        max-width: 1800px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 30px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 20px;
    }
}

/* Headers */
h1 {
    color: #1a1a1a;
    margin-bottom: 10px;
    font-size: 2.5em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 3px solid #c41e3a;
    padding-bottom: 10px;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2em;
        letter-spacing: 1.5px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.6em;
        letter-spacing: 1px;
    }
}

h2 {
    color: #1a1a1a;
    font-size: 1.8em;
    margin-bottom: 15px;
    font-weight: 600;
}

@media (max-width: 768px) {
    h2 {
        font-size: 1.5em;
    }
}

@media (max-width: 480px) {
    h2 {
        font-size: 1.3em;
    }
}

h3 {
    color: #4a4a4a;
    margin-bottom: 10px;
    font-size: 1.2em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

@media (max-width: 768px) {
    h3 {
        font-size: 1.1em;
    }
}

@media (max-width: 480px) {
    h3 {
        font-size: 1em;
        letter-spacing: 0.5px;
    }
}

.subtitle {
    color: #4a4a4a;
    margin-bottom: 30px;
    font-size: 1.1em;
}

@media (max-width: 768px) {
    .subtitle {
        font-size: 1em;
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    .subtitle {
        font-size: 0.95em;
    }
}

/* Tool List - Homepage Grid */
.tool-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

@media (max-width: 768px) {
    .tool-list {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 15px;
        margin-top: 30px;
    }
}

@media (max-width: 480px) {
    .tool-list {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-top: 20px;
    }
}

.tool-list .tool-card {
    background: #ffffff;
    border: 2px solid #4a4a4a;
    padding: 25px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    display: block;
}

.tool-list .tool-card:hover {
    border-color: #c41e3a;
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(196, 30, 58, 0.2);
}

.tool-list .tool-card h2 {
    color: #1a1a1a;
    font-size: 1.5em;
    margin-bottom: 12px;
    border-bottom: 2px solid #e8e8e8;
    padding-bottom: 8px;
}

.tool-list .tool-card p {
    color: #4a4a4a;
    line-height: 1.6;
    font-size: 0.95em;
}

/* Header Section */
.header {
    background: #1a1a1a;
    color: #ffffff;
    padding: 30px;
    text-align: center;
    position: relative;
    margin: -40px -40px 30px -40px;
    border-bottom: 3px solid #c41e3a;
}

@media (max-width: 768px) {
    .header {
        padding: 25px;
        margin: -30px -30px 20px -30px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 20px;
        margin: -20px -20px 15px -20px;
    }
}

.header h1 {
    color: #ffffff;
    border-bottom: none;
    padding-bottom: 0;
}

.header p {
    font-size: 1.1em;
    opacity: 0.9;
    color: #e8e8e8;
}

/* Upload Zone */
.upload-zone,
.upload-area,
.upload-section {
    border: 3px dashed #4a4a4a;
    border-radius: 0;
    padding: 40px;
    text-align: center;
    margin-bottom: 30px;
    background: #ffffff;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-zone:hover,
.upload-area:hover,
.upload-section:hover {
    border-color: #c41e3a;
    background: #e8e8e8;
    transform: translateY(-2px);
}

.upload-zone.dragover,
.upload-area.dragover {
    border-color: #c41e3a;
    background: #e8e8e8;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 3em;
    margin-bottom: 15px;
    color: #4a4a4a;
}

.upload-text {
    font-size: 1.2em;
    color: #4a4a4a;
    margin-bottom: 10px;
}

input[type="file"],
.file-input {
    display: none;
}

.file-input-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
    background: #1a1a1a;
    color: #ffffff;
    padding: 15px 30px;
    border-radius: 0;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid #1a1a1a;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.file-input-wrapper:hover {
    background: #c41e3a;
    border-color: #c41e3a;
    transform: translateY(-2px);
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    left: -9999px;
}

/* File Info */
.file-info {
    background: #e8e8e8;
    padding: 15px;
    border-radius: 0;
    margin-bottom: 20px;
    border: 2px solid #4a4a4a;
}

.file-info h3 {
    color: #1a1a1a;
    margin-bottom: 8px;
}

.file-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    font-size: 0.9em;
    color: #4a4a4a;
}

.stat {
    background: #ffffff;
    padding: 8px 12px;
    border-radius: 0;
    text-align: center;
    border: 1px solid #4a4a4a;
}

.stat strong {
    display: block;
    color: #c41e3a;
    font-size: 1.2em;
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

.erasure-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

@media (max-width: 768px) {
    .erasure-controls {
        grid-template-columns: 1fr;
    }
}

.control-group,
.option-group {
    background: #ffffff;
    padding: 25px;
    border-radius: 0;
    border: 2px solid #4a4a4a;
}

.control-group h3 {
    margin-bottom: 18px;
    margin-top: 0;
    color: #1a1a1a;
    padding-bottom: 10px;
    border-bottom: 2px solid #e8e8e8;
}

.control-group label,
.option-group label {
    font-weight: 600;
    color: #1a1a1a;
    display: block;
    margin-bottom: 10px;
    font-size: 1em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.control-group input,
.control-group select {
    padding: 12px 15px;
    border: 2px solid #4a4a4a;
    border-radius: 0;
    font-size: 1em;
    transition: all 0.3s ease;
    background: #ffffff;
    width: 100%;
    box-sizing: border-box;
}

.control-group input[type="checkbox"] {
    width: auto;
    padding: 0;
}

.control-group input:focus,
.control-group select:focus {
    outline: none;
    border-color: #c41e3a;
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.1);
}

/* Break Controls */
.break-control {
    background: #e8e8e8;
    border-radius: 0;
    padding: 20px;
    margin-bottom: 30px;
    border: 2px solid #4a4a4a;
}

.break-control h3 {
    color: #1a1a1a;
    margin-bottom: 15px;
}

.break-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.break-input,
.text-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #4a4a4a;
    border-radius: 0;
    font-size: 1em;
    font-family: 'Courier New', monospace;
    transition: border-color 0.3s ease;
    background: #ffffff;
}

.break-input:focus,
.text-input:focus {
    outline: none;
    border-color: #c41e3a;
}

/* Buttons */
.control-btn,
.break-btn,
.apply-btn,
.generate-btn,
.rearrange-btn {
    background: #1a1a1a;
    color: #ffffff;
    border: 2px solid #1a1a1a;
    padding: 15px 30px;
    border-radius: 0;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.control-btn:hover,
.break-btn:hover,
.apply-btn:hover,
.generate-btn:hover,
.rearrange-btn:hover {
    background: #c41e3a;
    border-color: #c41e3a;
    transform: translateY(-2px);
}

.control-btn:active,
.break-btn:active,
.apply-btn:active {
    transform: translateY(0);
}

.control-btn:disabled,
.break-btn:disabled,
.apply-btn:disabled,
.generate-btn:disabled,
.rearrange-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    background: #4a4a4a;
    border-color: #4a4a4a;
}

.reset-btn,
.clear-btn {
    background: #ffffff;
    color: #c41e3a;
    border: 2px solid #c41e3a;
    padding: 15px 30px;
    border-radius: 0;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.reset-btn:hover,
.clear-btn:hover {
    background: #c41e3a;
    color: #ffffff;
    transform: translateY(-2px);
}

/* Mode Buttons */
.mode-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.mode-btn {
    padding: 12px 24px;
    border: 2px solid #4a4a4a;
    border-radius: 0;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    background: #ffffff;
    color: #1a1a1a;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mode-btn.active {
    background: #1a1a1a;
    color: #ffffff;
    border-color: #1a1a1a;
}

.mode-btn:hover {
    border-color: #c41e3a;
}

/* Toggle Buttons */
.toggle-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: #e8e8e8;
    padding: 10px;
    border-radius: 0;
    border: 2px solid #4a4a4a;
    align-items: center;
    flex-wrap: wrap;
}

.font-size-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    padding: 8px 15px;
    background: #ffffff;
    border: 2px solid #4a4a4a;
}

.font-size-control label {
    font-size: 0.9em;
    font-weight: 600;
    color: #1a1a1a;
    white-space: nowrap;
    margin: 0;
}

.font-size-control .slider {
    width: 120px;
    height: 6px;
    margin: 0;
}

@media (max-width: 768px) {
    .font-size-control {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }

    .font-size-control .slider {
        width: 150px;
    }
}

.toggle-btn,
.view-toggle {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #4a4a4a;
    background: #ffffff;
    color: #1a1a1a;
    border-radius: 0;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.toggle-btn.active,
.view-toggle.active {
    background: #1a1a1a;
    color: #ffffff;
    border-color: #1a1a1a;
}

.toggle-btn:hover:not(.active),
.view-toggle:hover:not(.active) {
    background: #e8e8e8;
    border-color: #c41e3a;
}

/* Tool Cards */
.tools-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.tool-card {
    background: #ffffff;
    border: 2px solid #4a4a4a;
    border-radius: 0;
    padding: 20px;
    transition: all 0.3s ease;
}

.tool-card:hover {
    border-color: #c41e3a;
    transform: translateY(-2px);
}

.tool-card h3 {
    color: #1a1a1a;
    margin-bottom: 8px;
}

.tool-description {
    color: #4a4a4a;
    font-size: 0.9em;
    margin-bottom: 15px;
}

.tool-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reset-card {
    border-color: #c41e3a;
    background: #ffffff;
}

/* Toggle Groups within Cards */
.tool-card .toggle-group {
    display: flex;
    gap: 8px;
    background: #e8e8e8;
    padding: 5px;
    border-radius: 0;
    border: 2px solid #4a4a4a;
}

.tool-card .toggle-btn {
    flex: 1;
    padding: 10px 15px;
    border: none;
    background: transparent;
    color: #4a4a4a;
    border-radius: 0;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tool-card .toggle-btn.active {
    background: #1a1a1a;
    color: #ffffff;
    box-shadow: none;
}

/* Text Display */
.text-display {
    margin-top: 30px;
}

.text-box {
    background: #e8e8e8;
    border-radius: 0;
    padding: 20px;
    min-height: 300px;
    border: 2px solid #4a4a4a;
}

.text-content {
    background: #ffffff;
    border-radius: 0;
    padding: 20px;
    min-height: 250px;
    font-family: 'Courier New', monospace;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #1a1a1a;
    border: 2px solid #4a4a4a;
}

/* Output Sections */
.output,
.output-section,
.results-section {
    padding: 30px;
    background: #ffffff;
    border: 2px solid #4a4a4a;
    border-radius: 0;
    margin-top: 20px;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.output-title,
.results-header {
    font-size: 1.4em;
    font-weight: 600;
    color: #1a1a1a;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.output-container {
    max-height: 500px;
    overflow-y: auto;
    padding-right: 10px;
}

.output-container::-webkit-scrollbar {
    width: 8px;
}

.output-container::-webkit-scrollbar-track {
    background: #e8e8e8;
    border-radius: 0;
}

.output-container::-webkit-scrollbar-thumb {
    background: #4a4a4a;
    border-radius: 0;
}

.output-container::-webkit-scrollbar-thumb:hover {
    background: #c41e3a;
}

.output-text {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    line-height: 1.8;
    white-space: pre-wrap;
    background: #e8e8e8;
    padding: 30px;
    border-radius: 0;
    border: 2px dashed #4a4a4a;
    min-height: 300px;
    max-height: 600px;
    overflow-y: auto;
}

.placeholder-text {
    color: #4a4a4a;
    font-style: italic;
    text-align: center;
    padding: 60px 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Text Cards */
.text-card {
    background: #ffffff;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 0;
    border: 2px solid #4a4a4a;
    border-left: 4px solid #c41e3a;
    position: relative;
    transition: all 0.3s ease;
}

.text-card:hover {
    transform: translateX(5px);
    border-left-width: 8px;
}

.text-card::before {
    content: '"';
    font-size: 3em;
    color: rgba(196, 30, 58, 0.2);
    position: absolute;
    top: -10px;
    left: 15px;
    font-family: serif;
}

/* Radio Options */
.radio-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    border-radius: 0;
    background: #ffffff;
    border: 2px solid #4a4a4a;
    cursor: pointer;
    transition: all 0.3s ease;
}

.radio-option:hover {
    border-color: #c41e3a;
    background: #e8e8e8;
}

.radio-option.checked {
    border-color: #1a1a1a;
    background: #e8e8e8;
}

.radio-option input[type="radio"] {
    margin: 0;
    cursor: pointer;
    accent-color: #c41e3a;
}

.radio-option input[type="radio"]:checked + span {
    color: #c41e3a;
    font-weight: 600;
}

/* Checkboxes */
.checkbox-container {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    padding: 8px 0;
}

.checkbox-container input[type="checkbox"] {
    width: auto;
    margin-right: 12px;
    transform: scale(1.3);
    accent-color: #c41e3a;
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-container label {
    cursor: pointer;
    margin: 0;
    font-size: 0.95em;
    text-transform: none;
    letter-spacing: normal;
}

/* Sliders */
.slider-container {
    margin-bottom: 20px;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 600;
    color: #1a1a1a;
    font-size: 0.95em;
}

.slider {
    width: 100%;
    height: 8px;
    border-radius: 0;
    background: #e8e8e8;
    outline: none;
    -webkit-appearance: none;
    border: 1px solid #4a4a4a;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 0;
    background: #c41e3a;
    cursor: pointer;
    border: 2px solid #1a1a1a;
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 0;
    background: #c41e3a;
    cursor: pointer;
    border: 2px solid #1a1a1a;
}

/* Word Display */
.word-display {
    line-height: 1.6;
    font-size: 16px;
    color: #1a1a1a;
}

.word-display.horizontal {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.word-display.vertical {
    columns: auto;
    column-width: 200px;
    column-gap: 30px;
    column-fill: balance;
}

.word-item {
    padding: 4px 8px;
    background: #e8e8e8;
    border-radius: 0;
    display: inline-block;
    margin-bottom: 5px;
    transition: all 0.3s ease;
    break-inside: avoid;
    border: 1px solid #4a4a4a;
}

.word-item:hover {
    background: #c41e3a;
    color: #ffffff;
    transform: scale(1.05);
}

.frequency {
    color: #c41e3a;
    font-weight: 600;
    margin-left: 5px;
}

/* Stats */
.stats {
    text-align: center;
    margin-top: 15px;
    padding: 15px;
    background: #e8e8e8;
    border-radius: 0;
    color: #4a4a4a;
    font-style: italic;
    border: 2px solid #4a4a4a;
}

/* Error Messages */
.error-message {
    color: #c41e3a;
    margin-top: 10px;
    font-weight: 600;
    padding: 10px;
    background: rgba(196, 30, 58, 0.1);
    border: 2px solid #c41e3a;
    border-radius: 0;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #4a4a4a;
    border-radius: 50%;
    border-top-color: #c41e3a;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Content Grid */
.content {
    padding: 40px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-nav {
        flex-direction: column;
        gap: 10px;
    }
    
    .content {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 20px;
    }
    
    .tools-section {
        grid-template-columns: 1fr;
    }
    
    .mode-buttons {
        flex-direction: column;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .container {
        padding: 20px;
    }
    
    .upload-zone,
    .upload-area {
        padding: 30px 20px;
    }
}