/* Percentage Calculator Tool Styles */

/* Local CSS Variables for missing definitions */
:root {
    --text-dark: #1f2937; /* Using same as --text-color for consistency */
}

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

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

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

.tool-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.tool-header h1 i {
    color: var(--primary-color);
    font-size: 1.8rem;
}

.tool-description {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 0;
    line-height: 1.6;
}

/* Calculator Interface */
.calculator-interface {
    margin-bottom: 2rem;
}

.calculator-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

/* Type Selection */
.type-selection {
    margin-bottom: 2rem;
}

.section-label {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
}

.type-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
    background: #f8fafc;
    padding: 0.25rem;
    border-radius: 8px;
}

.type-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.75rem 0.5rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.type-tab:hover {
    background: rgba(50, 146, 82, 0.1);
    color: var(--primary-color);
}

.type-tab.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(50, 146, 82, 0.2);
}

.type-tab i {
    font-size: 1.2rem;
}

/* Calculation Forms */
.calculation-forms {
    margin-bottom: 2rem;
}

.calculation-form {
    display: none;
}

.calculation-form.active {
    display: block;
}

.form-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f3f4f6;
}

.form-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.form-header p {
    font-size: 0.875rem;
    color: var(--text-light);
    margin: 0;
}

.input-row {
    display: flex;
    align-items: end;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.input-group {
    flex: 1;
    min-width: 120px;
}

.input-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(50, 146, 82, 0.1);
}

.operator {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    padding: 0.75rem 0.5rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.change-type {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-dark);
    cursor: pointer;
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-mark {
    width: 18px;
    height: 18px;
    border: 2px solid #e5e7eb;
    border-radius: 50%;
    position: relative;
    transition: all 0.2s ease;
}

.radio-label input[type="radio"]:checked + .radio-mark {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

.radio-label input[type="radio"]:checked + .radio-mark::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.example-text {
    font-size: 0.875rem;
    color: var(--text-light);
    font-style: italic;
    text-align: center;
    margin-top: 0.5rem;
}

/* Action Controls */
.action-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.calculate-btn,
.clear-btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.calculate-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(50, 146, 82, 0.3);
}

.clear-btn {
    background: #f3f4f6;
    color: var(--text-dark);
}

.clear-btn:hover {
    background: #e5e7eb;
}

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

/* Result Section */
.result-section {
    margin-top: 2rem;
}

.result-display {
    background: white;
    border-radius: 12px;
    padding: 2rem;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f3f4f6;
}

.result-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.copy-result-btn {
    padding: 0.5rem;
    background: #f3f4f6;
    border: none;
    border-radius: 6px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.result-value-container {
    text-align: center;
    margin-bottom: 2rem;
}

.result-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    display: block;
}

.result-unit {
    font-size: 1.5rem;
    color: var(--text-light);
    font-weight: 500;
}

/* Calculation Breakdown */
.calculation-breakdown {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1.5rem;
}

.breakdown-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breakdown-steps {
    space-y: 0.75rem;
}

.breakdown-step {
    padding: 0.75rem;
    background: white;
    border-radius: 6px;
    margin-bottom: 0.75rem;
}

.step-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.step-formula {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    color: var(--primary-color);
    background: #f3f4f6;
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.25rem;
}

.step-result {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Loading, Error, and Success States */
.loading-indicator,
.error-message,
.success-message {
    text-align: center;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.loading-indicator {
    background: #f3f4f6;
    color: var(--text-light);
}

.error-message {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.success-message {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 0.5rem;
}

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

/* Popular Examples */
.popular-examples {
    margin-top: 2rem;
}

.popular-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.popular-title i {
    color: #fbbf24;
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.example-item {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.example-item:hover {
    border-color: var(--primary-color);
    background: rgba(50, 146, 82, 0.05);
    transform: translateY(-2px);
}

.example-icon {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.example-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.example-description {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Related Tools Section */
.related-tools-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.related-tools-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.related-tools-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.related-tools-header h3 i {
    color: var(--primary-color);
}

.related-tools-header p {
    color: var(--text-light);
    margin: 0.5rem 0 0 0;
    font-size: 0.95rem;
}

.related-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.related-tool-link {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    color: var(--primary-color);
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.related-tool-link:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(50, 146, 82, 0.3);
}

.related-tool-link i {
    font-size: 0.875rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .tool-container {
        padding: 1rem;
    }
    
    .calculator-card {
        padding: 1.5rem;
    }
    
    .type-tabs {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.25rem;
    }

    .type-tab {
        padding: 0.625rem 0.375rem;
        font-size: 0.75rem;
        gap: 0.125rem;
    }

    .type-tab i {
        font-size: 1rem;
    }

    .type-tab span {
        white-space: nowrap;
        font-size: 0.7rem;
    }
    
    .input-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .operator {
        text-align: center;
        padding: 0.5rem;
    }
    
    .action-controls {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .calculate-btn,
    .clear-btn {
        width: 100%;
        max-width: 280px;
        justify-content: center;
        padding: 1rem 1.5rem;
        font-size: 1rem;
        min-height: 48px;
    }
    
    .examples-grid {
        grid-template-columns: 1fr;
    }
    
    .result-value {
        font-size: 2.5rem;
    }
    
    .result-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .related-tools-section {
        padding: 1.5rem;
    }

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

    .related-tool-link {
        padding: 0.625rem 0.75rem;
        font-size: 0.8rem;
        flex-direction: column;
        gap: 4px;
    }

    .related-tool-link i {
        font-size: 1.1rem;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .type-tab {
        padding: 0.5rem 0.25rem;
        font-size: 0.7rem;
        gap: 0.125rem;
    }

    .type-tab i {
        font-size: 0.875rem;
    }

    .type-tab span {
        font-size: 0.65rem;
        line-height: 1.1;
    }

    .related-tools-section {
        padding: 1rem;
    }

    .related-tools-grid {
        grid-template-columns: 1fr;
    }

    .related-tool-link {
        flex-direction: row;
        gap: 8px;
        justify-content: flex-start;
        text-align: left;
    }
}
