/* ============================================================
   GoTools - Tool Page Styles
   Styles for individual tool interfaces
   ============================================================ */

/* ===== TOOL PAGE LAYOUT ===== */
.tool-page {
    max-width: 900px;
    margin: 0 auto;
}

.tool-page-wide {
    max-width: 1200px;
}

/* ===== TOOL UI WRAPPER ===== */
.tool-ui {
    background: var(--white);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

/* ===== TOOL HEADER ===== */
.tool-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--white) 100%);
}

.tool-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tool-header p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.tool-header-icon {
    font-size: 1.25rem;
}

/* ===== TOOL BODY ===== */
.tool-body {
    padding: 28px;
}

/* ===== TOOL INPUT GROUPS ===== */
.tool-input-group {
    margin-bottom: 20px;
}

.tool-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.tool-label-hint {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-left: 4px;
}

.tool-input {
    width: 100%;
    padding: 11px 16px;
    background: var(--gray-50);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.tool-input:focus {
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.tool-input::placeholder {
    color: var(--gray-400);
}

.tool-input-lg {
    padding: 14px 18px;
    font-size: 1.125rem;
}

.tool-select {
    width: 100%;
    padding: 11px 16px;
    background: var(--gray-50);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3e%3cpath d='m6 9 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 40px;
    cursor: pointer;
}

.tool-select:focus {
    border-color: var(--primary);
    background-color: var(--white);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.tool-textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--gray-50);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--text-primary);
    resize: vertical;
    min-height: 120px;
    font-family: var(--font-body);
    line-height: 1.6;
    transition: all var(--transition-fast);
}

.tool-textarea:focus {
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.tool-textarea::placeholder {
    color: var(--gray-400);
}

/* Input group with inline elements */
.tool-input-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.tool-input-row .tool-input-group {
    flex: 1;
    margin-bottom: 0;
}

/* ===== TOOL BUTTONS ===== */
.tool-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 24px 0;
}

.tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    white-space: nowrap;
}

.tool-btn-primary {
    background: var(--primary-gradient);
    color: var(--white);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.tool-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

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

.tool-btn-secondary {
    background: var(--gray-100);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.tool-btn-secondary:hover {
    background: var(--gray-200);
}

.tool-btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.tool-btn-danger:hover {
    background: var(--danger);
    color: var(--white);
}

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

.tool-btn-sm {
    padding: 7px 16px;
    font-size: 0.8125rem;
}

.tool-btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.tool-btn-full {
    width: 100%;
}

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

/* ===== TOOL RESULTS ===== */
.tool-result {
    margin-top: 24px;
    padding: 24px;
    background: linear-gradient(135deg, var(--gray-50) 0%, rgba(99, 102, 241, 0.03) 100%);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    animation: fadeInUp 0.4s ease;
}

.tool-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.tool-result-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== RESULT CARDS ===== */
.tool-result-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    border: 1px solid var(--border-light);
    text-align: center;
    transition: all var(--transition-fast);
}

.tool-result-card:hover {
    box-shadow: var(--shadow-sm);
}

.tool-result-value {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
    margin-bottom: 4px;
}

.tool-result-value.large {
    font-size: 2.25rem;
}

.tool-result-value.success { color: var(--success); }
.tool-result-value.danger { color: var(--danger); }
.tool-result-value.warning { color: var(--warning); }

.tool-result-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== RESULT GRIDS ===== */
.tool-grid {
    display: grid;
    gap: 12px;
}

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

/* ===== TOOL DIVIDER ===== */
.tool-divider {
    height: 1px;
    background: var(--border-light);
    margin: 20px 0;
}

/* ===== TOOL NOTE ===== */
.tool-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: var(--info-bg);
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    color: var(--info);
    margin-top: 12px;
    line-height: 1.5;
}

.tool-note-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.tool-note-success {
    background: var(--success-bg);
    color: var(--success);
}

.tool-note-icon {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ===== TOOL TABLE ===== */
.tool-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.tool-table th {
    background: var(--gray-50);
    padding: 10px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.tool-table td {
    padding: 10px 16px;
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

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

.tool-table tr:hover td {
    background: var(--gray-50);
}

/* ===== TOOL COPY BUTTON ===== */
.tool-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--gray-100);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tool-copy-btn:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.tool-copy-btn.copied {
    background: var(--success);
    color: var(--white);
    border-color: var(--success);
}

/* ===== TOOL RANGE SLIDER ===== */
.tool-range {
    width: 100%;
    height: 6px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.tool-range::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
    transition: transform var(--transition-fast);
}

.tool-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.tool-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

.tool-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== TOOL SWITCH (Toggle) ===== */
.tool-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.tool-switch input {
    display: none;
}

.tool-switch-track {
    width: 44px;
    height: 24px;
    background: var(--gray-300);
    border-radius: var(--radius-full);
    position: relative;
    transition: background var(--transition-fast);
}

.tool-switch input:checked + .tool-switch-track {
    background: var(--primary);
}

.tool-switch-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: var(--white);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast);
}

.tool-switch input:checked + .tool-switch-track::after {
    transform: translateX(20px);
}

.tool-switch-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* ===== TOOL RADIO GROUP ===== */
.tool-radio-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.tool-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.tool-radio input { display: none; }

.tool-radio-mark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.tool-radio input:checked + .tool-radio-mark {
    border-color: var(--primary);
}

.tool-radio input:checked + .tool-radio-mark::after {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
}

.tool-radio-label {
    font-size: 0.8125rem;
    color: var(--text-primary);
}

/* ===== TOOL CHECKBOX GROUP ===== */
.tool-checkbox-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.tool-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--text-primary);
}

.tool-checkbox input { display: none; }

.tool-checkbox-mark {
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 2px solid var(--gray-300);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.tool-checkbox input:checked + .tool-checkbox-mark {
    background: var(--primary);
    border-color: var(--primary);
}

.tool-checkbox input:checked + .tool-checkbox-mark::after {
    content: '✓';
    color: var(--white);
    font-size: 0.6875rem;
    font-weight: 700;
}

/* ===== TOOL COLOR INPUT ===== */
.tool-color-input {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tool-color-input input[type="color"] {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    padding: 2px;
}

.tool-color-input input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.tool-color-input input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

/* ===== TOOL FILE INPUT ===== */
.tool-file-input {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.tool-file-input:hover,
.tool-file-input.dragover {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.tool-file-input input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.tool-file-input-icon {
    font-size: 2rem;
    margin-bottom: 12px;
    color: var(--gray-400);
}

.tool-file-input-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.tool-file-input-text strong {
    color: var(--primary);
}

.tool-file-input-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== TOOL OUTPUT / PREVIEW ===== */
.tool-output {
    background: var(--gray-50);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    min-height: 100px;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-primary);
    overflow-x: auto;
    word-break: break-word;
}

.tool-output-mono {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
}

/* ===== TOOL CODE BLOCK ===== */
.tool-code {
    background: var(--gray-900);
    color: #e2e8f0;
    border-radius: var(--radius-md);
    padding: 16px 20px;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.7;
    overflow-x: auto;
    position: relative;
}

.tool-code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.tool-code-lang {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-400);
}

/* ===== TOOL TABS ===== */
.tool-tabs {
    display: flex;
    gap: 2px;
    padding: 3px;
    background: var(--gray-100);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.tool-tab {
    flex: 1;
    padding: 9px 16px;
    text-align: center;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    background: none;
}

.tool-tab.active {
    background: var(--white);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.tool-tab:hover:not(.active) {
    color: var(--text-primary);
}

.tool-tab-content {
    display: none;
}

.tool-tab-content.active {
    display: block;
    animation: fadeIn 0.25s ease;
}

/* ===== TOOL CHART CONTAINER ===== */
.tool-chart {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.tool-chart canvas {
    width: 100% !important;
    height: auto !important;
}

/* Simple Donut/Pie via CSS */
.tool-donut {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    position: relative;
    margin: 0 auto;
}

.tool-donut-center {
    position: absolute;
    inset: 30px;
    background: var(--white);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.tool-donut-center .value {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
}

.tool-donut-center .label {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

/* ===== TOOL PROGRESS BAR ===== */
.tool-progress {
    height: 8px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin: 8px 0;
}

.tool-progress-bar {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: var(--radius-full);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.tool-progress-bar.success { background: var(--success); }
.tool-progress-bar.warning { background: var(--warning); }
.tool-progress-bar.danger { background: var(--danger); }

/* ===== TOOL HOW TO USE SECTION ===== */
.tool-how-to {
    margin-top: 32px;
    padding: 24px 28px;
    border-top: 1px solid var(--border-light);
}

.tool-how-to h3 {
    font-size: 1.125rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-how-to ol {
    padding-left: 20px;
}

.tool-how-to ol li {
    list-style: decimal;
    margin-bottom: 10px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===== TOOL RELATED TOOLS ===== */
.tool-related {
    margin-top: 32px;
}

.tool-related h3 {
    font-size: 1.125rem;
    margin-bottom: 16px;
}

.tool-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

/* ===== TOOL FAQ ===== */
.tool-faq {
    margin-top: 32px;
}

.tool-faq h3 {
    font-size: 1.125rem;
    margin-bottom: 16px;
}

/* ===== ANIMATIONS FOR TOOL RESULTS ===== */
.tool-result .tool-result-card {
    opacity: 0;
    animation: fadeInUp 0.3s ease forwards;
}

.tool-result .tool-result-card:nth-child(1) { animation-delay: 0.05s; }
.tool-result .tool-result-card:nth-child(2) { animation-delay: 0.1s; }
.tool-result .tool-result-card:nth-child(3) { animation-delay: 0.15s; }
.tool-result .tool-result-card:nth-child(4) { animation-delay: 0.2s; }
.tool-result .tool-result-card:nth-child(5) { animation-delay: 0.25s; }
.tool-result .tool-result-card:nth-child(6) { animation-delay: 0.3s; }

/* ===== CANVAS CONTAINER ===== */
.tool-canvas-wrap {
    background: var(--gray-50);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.tool-canvas-wrap canvas {
    max-width: 100%;
    border-radius: var(--radius-sm);
}

/* ===== RESPONSIVE TOOL GRIDS ===== */
@media (max-width: 991px) {
    .tool-grid-2 { grid-template-columns: 1fr; }
    .tool-grid-3 { grid-template-columns: repeat(2, 1fr); }
    .tool-grid-4 { grid-template-columns: repeat(2, 1fr); }

    .tool-body { padding: 20px; }
    .tool-header { padding: 20px; }
    .tool-how-to { padding: 20px; }

    .tool-input-row {
        flex-direction: column;
    }

    .tool-actions {
        flex-direction: column;
    }

    .tool-btn-full-mobile {
        width: 100%;
    }

    .tool-result-value { font-size: 1.5rem; }
    .tool-result-value.large { font-size: 1.75rem; }
}

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

    .tool-radio-group,
    .tool-checkbox-group {
        flex-direction: column;
    }
}

/* ===== TOOL GUIDE & FAQS ===== */
.tool-guide-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1.5px dashed var(--border-light);
}

.tool-guide-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.tool-guide-card {
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border-light);
}

.tool-guide-card h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tool-guide-card p, .tool-guide-card li {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.tool-guide-card ul {
    margin-top: 8px;
    padding-left: 20px;
}

.tool-guide-card li {
    margin-bottom: 6px;
}

/* Accordion FAQs using details/summary */
.tool-faq-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tool-faq-item {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--white);
    transition: all var(--transition-fast);
}

.tool-faq-item[open] {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.05);
}

.tool-faq-question {
    padding: 16px 20px;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.tool-faq-question::-webkit-details-marker {
    display: none;
}

.tool-faq-question::after {
    content: '+';
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text-secondary);
    transition: transform var(--transition-fast);
}

.tool-faq-item[open] .tool-faq-question::after {
    content: '−';
    transform: rotate(180deg);
    color: var(--primary);
}

.tool-faq-answer {
    padding: 0 20px 16px 20px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}
