
:root {
    --primary-color: #8B5A3C;
    --primary-light: #A2704E;
    --primary-dark: #6F442A;
    --primary-soft: rgba(139, 90, 60, 0.08);
    --primary-mid: rgba(139, 90, 60, 0.12);
    --primary-dark-bg: #5D3E2E;
    --background-color: #FFFFFF;
    --surface-color: #F8F6F2;
    --surface-elevated: #FFFFFF;
    --border-color: #EBE3DA;
    --border-light: #F0EAE3;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.03), 0 2px 4px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.05), 0 4px 8px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 12px 28px -8px rgba(100, 70, 40, 0.12);
    --text-primary: #2C241A;
    --text-secondary: #6B5A4A;
    --text-tertiary: #9B8B7A;
    --transition-default: all 0.2s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    --success-color: #2E7D32;
    --warning-color: #ED6C02;
    --error-color: #D32F2F;
    --info-color: #0288D1;
}

.analyzer-container {
    max-width: 1200px;
    margin: 32px auto;
    padding: 32px;
    background: var(--surface-elevated);
    border-radius: 18px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-default);
}

.analyzer-container:hover {
    box-shadow: var(--shadow-md);
}

.header-section {
    text-align: center;
    margin-bottom: 36px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.header-section h1 {
    font-size: clamp(28px, 6vw, 36px);
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 16px;
    letter-spacing: -0.5px;
    position: relative;
    display: inline-block;
}

.header-section h1::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px;
}

.header-section p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 700px;
    margin: 12px auto 0;
}

.header-section p:first-of-type {
    margin-top: 16px;
}

.input-section {
    background: var(--surface-color);
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 32px;
    border: 1px solid var(--border-color);
    transition: var(--transition-default);
}

.url-input {
    width: 100%;
    padding: 14px 20px;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition-default);
    background: var(--surface-elevated);
    color: var(--text-primary);
    box-sizing: border-box;
    direction: ltr;
}

.url-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.url-input::placeholder {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    direction: rtl;
}

.submit-btn {
    width: 100%;
    margin-top: 20px;
    padding: 14px 28px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-default);
    letter-spacing: 0.3px;
}

.submit-btn:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.submit-btn:active {
    transform: translateY(0);
}

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

.error-message {
    display: none;
    background: linear-gradient(135deg, #FFEBEE, #FFCDD2);
    color: var(--error-color);
    padding: 14px 20px;
    border-radius: 16px;
    margin-top: 16px;
    font-size: 0.85rem;
    border-right: 3px solid var(--error-color);
}

.loading-spinner {
    display: none;
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin: 40px auto;
    animation: spin 0.8s linear infinite;
}

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

.result-section {
    display: none;
    animation: fadeInUp 0.4s ease-out;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--surface-color);
    padding: 24px 20px;
    border-radius: 14px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: var(--transition-default);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-light), var(--primary-color));
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-light);
}

.stat-card h3 {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card p {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.2;
}

.words-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 24px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.words-table thead tr {
    background: var(--surface-color);
    border-bottom: 2px solid var(--border-color);
}

.words-table th {
    padding: 16px 20px;
    text-align: right;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    letter-spacing: 0.3px;
}

.words-table td {
    padding: 14px 20px;
    text-align: right;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.words-table tbody tr {
    transition: var(--transition-default);
}

.words-table tbody tr:hover {
    background: var(--primary-soft);
}

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

.words-table td:first-child {
    font-weight: 600;
    color: var(--primary-dark);
    font-family: monospace;
    font-size: 0.95rem;
}

.words-table td:last-child {
    color: var(--text-primary);
}

.words-table tfoot tr {
    background: var(--surface-color);
}

.words-table tfoot td {
    padding: 16px 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

.tfootr span {
    display: inline-block;
    background: var(--primary-soft);
    padding: 6px 16px;
    border-radius: 12px;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.stat-card {
    animation: fadeInUp 0.3s ease-out;
    animation-fill-mode: backwards;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }

@media (max-width: 768px) {
    .analyzer-container {
        margin: 20px 16px;
        padding: 24px 20px;
        border-radius: 12px;
    }

    .header-section h1 {
        font-size: 26px;
    }

    .header-section p {
        font-size: 0.85rem;
    }

    .input-section {
        padding: 20px;
    }

    .url-input {
        padding: 12px 18px;
        font-size: 0.9rem;
    }

    .submit-btn {
        padding: 12px 24px;
        font-size: 0.9rem;
    }

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

    .stat-card {
        padding: 18px 16px;
    }

    .stat-card p {
        font-size: 1.8rem;
    }

    .words-table th,
    .words-table td {
        padding: 12px 16px;
    }
}

@media (max-width: 560px) {
    .analyzer-container {
        margin: 12px;
        padding: 20px 16px;
        border-radius: 12px;
    }

    .header-section h1 {
        font-size: 22px;
    }

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

    .stat-card {
        padding: 16px;
    }

    .stat-card p {
        font-size: 1.5rem;
    }

    .words-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .words-table th,
    .words-table td {
        padding: 10px 14px;
        font-size: 0.85rem;
    }
}

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 16px;
}

.result-section:empty {
    display: none;
}

@media (max-width: 560px) {
    .words-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}