:root {
    --primary: #4361ee;
    --primary-light: #4895ef;
    --secondary: #3f37c9;
    --success: #4cc9f0;
    --dark: #2b2d42;
    --light: #f8f9fa;
    --gray: #adb5bd;
    --border-radius: 8px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

.word-counter-tool-wrapper {
    margin: 0 auto;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.word-counter-container {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    max-width: 1200px;
    margin: 0 auto;
}

.word-counter-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 30px;
    text-align: center;
}

.word-counter-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.word-counter-header p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 0;
}

.word-counter-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 600px;
}

@media (max-width: 1024px) {
    .word-counter-main {
        grid-template-columns: 1fr;
    }
}

.word-counter-editor-section {
    padding: 30px;
    border-right: 1px solid #eaeaea;
    background: #fafafa;
}

@media (max-width: 1024px) {
    .word-counter-editor-section {
        border-right: none;
        border-bottom: 1px solid #eaeaea;
    }
}

.word-counter-stats-section {
    padding: 30px;
    background: white;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: var(--primary);
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 10px;
    font-weight: 600;
}

.text-editor {
    width: 100%;
    min-height: 300px;
    padding: 20px;
    border: 2px solid #e1e5e9;
    border-radius: var(--border-radius);
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    margin-bottom: 25px;
    transition: var(--transition);
    background: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.text-editor:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.button-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 25px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.95rem;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--light);
    color: var(--dark);
    border: 1px solid var(--gray);
}

.btn-secondary:hover {
    background-color: #e9ecef;
    transform: translateY(-2px);
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: #3aa8d0;
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: var(--light);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    transition: var(--transition);
    border: 1px solid #eaeaea;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.analysis-section {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid #eaeaea;
}

.analysis-section .section-title {
    font-size: 1.3rem;
}

.readability-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.keyword-density-section {
    grid-column: 1 / -1;
    background: white;
    padding: 30px;
    border-top: 1px solid #eaeaea;
}

.keyword-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.keyword-table th,
.keyword-table td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.keyword-table th {
    background-color: var(--primary);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
}

.keyword-table tr:last-child td {
    border-bottom: none;
}

.keyword-table tr:hover td {
    background-color: #f8f9fa;
}

.word-counter-footer {
    text-align: center;
    padding: 25px;
    background: var(--light);
    border-top: 1px solid #eaeaea;
    color: var(--dark);
    font-size: 0.9rem;
}

.word-counter-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.word-counter-footer a:hover {
    text-decoration: underline;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    margin-top: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    transition: width 0.3s ease;
    width: 0%;
}

.export-options {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary);
}

.export-options h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--dark);
}

.export-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.highlight {
    background-color: rgba(67, 97, 238, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 500;
}

/* Loading animation */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .word-counter-header {
        padding: 20px;
    }
    
    .word-counter-header h1 {
        font-size: 2rem;
    }
    
    .word-counter-editor-section,
    .word-counter-stats-section {
        padding: 20px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .stats-grid,
    .readability-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .word-counter-wrapper {
        padding: 10px;
    }
    
    .text-editor {
        min-height: 250px;
    }
    
    .keyword-table {
        font-size: 0.9rem;
    }
    
    .keyword-table th,
    .keyword-table td {
        padding: 10px 15px;
    }
}