/* ============ TOOLS COMMON ============ */

/* Dropdown Nav */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 260px;
    padding: 0.5rem 0;
    z-index: 200;
    margin-top: 0.5rem;
}

.nav-dropdown:hover .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.65rem 1.25rem;
    font-size: 0.88rem;
    color: var(--text);
    text-decoration: none;
    transition: background var(--transition);
}

.nav-dropdown-menu a:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.nav-dropdown-menu a i {
    width: 18px;
    text-align: center;
    color: var(--primary-light);
}

/* Tool Page Layout */
.tool-hero {
    padding: 7rem 0 3rem;
    text-align: center;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1e293b 100%);
    color: #fff;
}

.tool-hero h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.tool-hero p {
    color: #94a3b8;
    font-size: 1.05rem;
    max-width: 600px;
    margin: 0 auto;
}

.tool-content {
    padding: 2.5rem 0 4rem;
}

.tool-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    margin-bottom: 2rem;
}

.tool-card h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-card h2 i {
    color: var(--primary);
}

/* Input Groups */
.tool-input-group {
    margin-bottom: 1rem;
}

.tool-input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.tool-input-group small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.3rem;
}

.tool-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--bg);
    transition: border-color var(--transition);
    color: var(--text);
}

.tool-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

textarea.tool-input {
    min-height: 160px;
    resize: vertical;
    line-height: 1.6;
}

.tool-input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 600px) {
    .tool-input-row { grid-template-columns: 1fr; }
}

/* Buttons */
.tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.tool-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(79,70,229,0.35);
}

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

.tool-btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
}

.tool-btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: none;
}

.tool-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

/* Results */
.tool-result {
    display: none;
    margin-top: 2rem;
}

.tool-result.active {
    display: block;
}

/* Tables */
.tool-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.tool-table thead {
    background: var(--bg);
}

.tool-table th,
.tool-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.tool-table th {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tool-table tbody tr:hover {
    background: #f8fafc;
}

/* Status badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #ecfdf5; color: #065f46; }
.badge-warning { background: #fffbeb; color: #92400e; }
.badge-error { background: #fef2f2; color: #991b1b; }
.badge-info { background: #eff6ff; color: #1e40af; }

/* Progress bar */
.density-bar-wrap {
    height: 8px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
    min-width: 100px;
}

.density-bar {
    height: 100%;
    border-radius: 99px;
    background: var(--primary);
    transition: width 0.5s ease;
}

/* Loading overlay */
.tool-loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 2rem;
    color: var(--text-light);
}

.tool-loading.active {
    display: flex;
}

.tool-loading .spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Code block */
.code-block {
    position: relative;
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 1.25rem;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 1.7;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.code-block .copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255,255,255,0.1);
    color: #94a3b8;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.code-block .copy-btn:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* SERP Preview */
.serp-preview-box {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    background: #fff;
    max-width: 600px;
}

.serp-title {
    font-size: 1.2rem;
    color: #1a0dab;
    font-weight: 400;
    line-height: 1.3;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.serp-title:hover {
    text-decoration: underline;
}

.serp-url {
    font-size: 0.85rem;
    color: #006621;
    margin: 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.serp-description {
    font-size: 0.88rem;
    color: #4d5156;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.serp-mobile .serp-title {
    font-size: 1.05rem;
}

.serp-mobile .serp-url {
    font-size: 0.78rem;
}

.serp-mobile .serp-description {
    font-size: 0.82rem;
}

.char-counter {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 4px;
    text-align: right;
}

.char-counter.over {
    color: var(--error);
    font-weight: 600;
}

/* Redirect chain */
.redirect-chain {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.redirect-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    position: relative;
    padding: 1rem 0;
}

.redirect-step:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 17px;
    top: 42px;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.redirect-step-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
    z-index: 1;
}

.redirect-step-icon.code-301 { background: #dbeafe; color: #1e40af; }
.redirect-step-icon.code-302 { background: #fef3c7; color: #92400e; }
.redirect-step-icon.code-200 { background: #d1fae5; color: #065f46; }
.redirect-step-icon.code-error { background: #fee2e2; color: #991b1b; }

.redirect-step-details {
    flex: 1;
    min-width: 0;
}

.redirect-step-url {
    font-weight: 600;
    font-size: 0.9rem;
    word-break: break-all;
    color: var(--text);
}

.redirect-step-meta {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 2px;
}

/* Sitemap tree */
.sitemap-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px,1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.sitemap-stat {
    text-align: center;
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
}

.sitemap-stat .num {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
}

.sitemap-stat .label {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 2px;
}

/* Broken links */
.link-status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.75rem;
}

.link-ok { background: #d1fae5; color: #065f46; }
.link-broken { background: #fee2e2; color: #991b1b; }
.link-redirect { background: #dbeafe; color: #1e40af; }
.link-timeout { background: #fef3c7; color: #92400e; }

/* Tool page grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.tool-grid-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: all var(--transition);
    text-decoration: none;
    color: inherit;
    display: block;
}

.tool-grid-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.tool-grid-card .tool-grid-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.tool-grid-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.tool-grid-card p {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.5;
}

/* Progress for link checker */
.progress-wrap {
    height: 6px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 99px;
    transition: width 0.3s;
    width: 0%;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--text-light);
    text-align: center;
}
