/* Character Counter Tool Styles */

/* Tool Container - Full Page Layout */
.character-counter-tool {
    width: 100%;
    min-height: 100vh;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 0;
    margin: 0;
}

.tool-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

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

.tool-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: rgb(20, 19, 19);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.tool-description {
    font-size: 1rem;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Counter Interface */
.counter-interface {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-bottom: 4rem;
}

/* Text Input Section */
.text-input-section {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
}

.input-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.paste-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.copy-btn {
    background: #3b82f6;
    color: var(--white);
}

.copy-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.25);
}

.clear-btn {
    background: #ef4444;
    color: var(--white);
}

.clear-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.25);
}

.copy-stats-btn {
    background: #8b5cf6;
    color: var(--white);
}

.copy-stats-btn:hover {
    background: #7c3aed;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(139, 92, 246, 0.25);
}

.export-btn {
    background: #f59e0b;
    color: var(--white);
}

.export-btn:hover {
    background: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(245, 158, 11, 0.25);
}

.action-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.textarea-container {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #e5e7eb;
    transition: all 0.3s ease-in-out;
    background: var(--white);
}

.textarea-container:hover {
    border-color: #d1d5db;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.textarea-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1), 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.textarea-container.limit-exceeded {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1), 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

#textInput {
    width: 100%;
    min-height: 400px;
    padding: 1.5rem;
    border: none;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-color);
    background: transparent;
    resize: vertical;
    transition: all 0.2s ease-in-out;
}

#textInput::placeholder {
    color: #9ca3af;
    font-style: normal;
    font-weight: 400;
    opacity: 1;
}

.textarea-footer {
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.quick-stats {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.limit-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.limit-label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
    white-space: nowrap;
}

.limit-input {
    width: 100px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    transition: all 0.2s ease-in-out;
}

.limit-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.1);
}

.limit-clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: #ef4444;
    color: var(--white);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-size: 0.75rem;
}

.limit-clear-btn:hover {
    background: #dc2626;
    transform: scale(1.05);
}

/* Statistics Section */
.statistics-section {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.stats-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.stats-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-light);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

/* Primary stat card (Characters) - Green theme */
.stat-card.primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: var(--white);
    border-color: var(--primary-color);
}

/* Characters (no spaces) stat card - Blue theme */
.stat-card.blue {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: var(--white);
    border-color: #3b82f6;
}

/* Words stat card - Purple theme */
.stat-card.purple {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: var(--white);
    border-color: #8b5cf6;
}

/* Lines stat card - Orange theme */
.stat-card.orange {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: var(--white);
    border-color: #f59e0b;
}

/* Paragraphs stat card - Teal theme */
.stat-card.teal {
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    color: var(--white);
    border-color: #14b8a6;
}

/* Sentences stat card - Red theme */
.stat-card.red {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: var(--white);
    border-color: #ef4444;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-color);
    font-size: 1.25rem;
}

/* Colored stat card icons */
.stat-card.primary .stat-icon,
.stat-card.blue .stat-icon,
.stat-card.purple .stat-icon,
.stat-card.orange .stat-icon,
.stat-card.teal .stat-icon,
.stat-card.red .stat-icon {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1;
    margin-bottom: 0.25rem;
    transition: all 0.3s ease;
}

.stat-number.updated {
    transform: scale(1.1);
    color: var(--primary-color);
}

/* Colored stat card numbers */
.stat-card.primary .stat-number,
.stat-card.blue .stat-number,
.stat-card.purple .stat-number,
.stat-card.orange .stat-number,
.stat-card.teal .stat-number,
.stat-card.red .stat-number {
    color: var(--white);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-light);
    font-weight: 500;
}

/* Colored stat card labels */
.stat-card.primary .stat-label,
.stat-card.blue .stat-label,
.stat-card.purple .stat-label,
.stat-card.orange .stat-label,
.stat-card.teal .stat-label,
.stat-card.red .stat-label {
    color: rgba(255, 255, 255, 0.9);
}

/* Limit Warning */
.limit-warning {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 1px solid #fecaca;
    border-radius: var(--border-radius);
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    animation: slideIn 0.3s ease-out;
}

.warning-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #dc2626;
}

.warning-content i {
    font-size: 1.25rem;
    color: #ef4444;
}

.warning-text {
    font-weight: 600;
    font-size: 0.875rem;
}

.warning-details {
    font-size: 0.875rem;
    color: #991b1b;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Additional Stats */
.additional-stats {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label-inline {
    font-size: 0.875rem;
    color: var(--text-color);
    font-weight: 500;
}

.stat-value {
    font-size: 0.875rem;
    color: var(--primary-color);
    font-weight: 600;
}

/* Tool Features */
.tool-features {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    margin-bottom: 3rem;
}

.tool-features h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    text-align: center;
    margin-bottom: 2rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.feature-item {
    text-align: center;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    background: var(--bg-light);
    transition: var(--transition);
}

.feature-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.feature-item i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.feature-item h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.feature-item p {
    font-size: 0.875rem;
    color: var(--text-light);
    line-height: 1.5;
    margin: 0;
}

/* Dark Mode Toggle Button */
.dark-mode-toggle {
    background: #6b7280;
    color: var(--white);
}

.dark-mode-toggle:hover {
    background: #4b5563;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(107, 114, 128, 0.25);
}

/* Dark Mode Styles */
[data-theme="dark"] .character-counter-tool {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

[data-theme="dark"] .tool-container {
    color: #f9fafb;
}

[data-theme="dark"] .tool-header h1 {
    color: #f9fafb;
}

[data-theme="dark"] .tool-description {
    color: #d1d5db;
}

[data-theme="dark"] .text-input-section,
[data-theme="dark"] .statistics-section,
[data-theme="dark"] .tool-features {
    background: #1f2937;
    border-color: #374151;
}

[data-theme="dark"] .input-header {
    background: #374151;
    border-color: #4b5563;
}

[data-theme="dark"] .input-header h2,
[data-theme="dark"] .stats-header h2 {
    color: #f9fafb;
}

[data-theme="dark"] .textarea-container {
    border-color: #374151;
    background: #111827;
}

[data-theme="dark"] .textarea-container:hover {
    border-color: #4b5563;
}

[data-theme="dark"] .textarea-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1), 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] #textInput {
    background: #111827;
    color: #f9fafb;
}

[data-theme="dark"] #textInput::placeholder {
    color: #9ca3af;
}

[data-theme="dark"] .textarea-footer {
    background: #374151;
    border-color: #4b5563;
}

[data-theme="dark"] .quick-stats {
    color: #d1d5db;
}

[data-theme="dark"] .limit-label {
    color: #d1d5db;
}

[data-theme="dark"] .limit-input {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

[data-theme="dark"] .limit-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.1);
}

[data-theme="dark"] .stat-card {
    background: #374151;
    border-color: #4b5563;
}

[data-theme="dark"] .stat-number {
    color: #f9fafb;
}

[data-theme="dark"] .stat-label {
    color: #d1d5db;
}

[data-theme="dark"] .additional-stats {
    border-color: #4b5563;
}

[data-theme="dark"] .stat-row {
    border-color: #4b5563;
}

[data-theme="dark"] .stat-label-inline {
    color: #f9fafb;
}

[data-theme="dark"] .feature-item {
    background: #374151;
}

[data-theme="dark"] .feature-item h3 {
    color: #f9fafb;
}

[data-theme="dark"] .feature-item p {
    color: #d1d5db;
}

[data-theme="dark"] .limit-warning {
    background: linear-gradient(135deg, #7f1d1d, #991b1b);
    border-color: #dc2626;
}

[data-theme="dark"] .warning-content {
    color: #fecaca;
}

[data-theme="dark"] .warning-details {
    color: #fca5a5;
}

/* Dark Mode Support for System Preference */
@media (prefers-color-scheme: dark) {
    .character-counter-tool {
        background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    }

    .textarea-container {
        border-color: #374151;
        background: #1f2937;
    }

    .textarea-container:hover {
        border-color: #4b5563;
    }

    #textInput {
        background: #1f2937;
        color: #f9fafb;
    }

    #textInput::placeholder {
        color: #9ca3af;
    }

    .textarea-footer {
        background: #374151;
        border-color: #4b5563;
    }

    .limit-input {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
}

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

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .counter-interface {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

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

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .character-counter-tool {
        padding: 0;
    }

    .tool-container {
        padding: 1rem;
    }

    .tool-header {
        margin-bottom: 1.5rem;
        padding: 0.5rem 0;
    }

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

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

    .features-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .input-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
        padding: 1rem 1.5rem;
    }

    .header-actions {
        justify-content: center;
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .action-btn {
        flex: 1;
        justify-content: center;
        min-height: 44px;
        min-width: 80px;
    }

    .stats-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .stats-actions {
        justify-content: center;
        flex-wrap: wrap;
    }

    #textInput {
        min-height: 300px;
        padding: 1.25rem;
        font-size: 1rem;
        line-height: 1.5;
    }

    .textarea-container {
        border-radius: 10px;
    }

    .textarea-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .limit-controls {
        justify-content: center;
        flex-wrap: wrap;
    }

    .statistics-section {
        padding: 1.5rem;
    }

    .stat-card {
        padding: 1.25rem;
        gap: 0.75rem;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .tool-features {
        padding: 1.5rem;
    }

    .feature-item {
        padding: 1.25rem;
    }

    .feature-item i {
        font-size: 1.75rem;
    }
}

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

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

    .tool-description {
        font-size: 0.875rem;
    }

    .input-header {
        padding: 1rem;
    }

    .header-actions {
        gap: 0.25rem;
    }

    .action-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
        min-width: 70px;
    }

    #textInput {
        min-height: 250px;
        padding: 1rem;
        font-size: 0.875rem;
    }

    .statistics-section {
        padding: 1rem;
    }

    .stat-card {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .stat-number {
        font-size: 1.25rem;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }

    .limit-input {
        width: 80px;
        padding: 0.375rem 0.5rem;
        font-size: 0.75rem;
    }

    .limit-clear-btn {
        width: 24px;
        height: 24px;
        font-size: 0.625rem;
    }

    .warning-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* Print Styles */
@media print {
    .character-counter-tool {
        background: white;
    }

    .header-actions,
    .stats-actions,
    .action-btn {
        display: none;
    }

    .tool-features {
        page-break-before: always;
    }
}
