/* ============================================
   Percentage Calculator Styles
   ============================================ */

/* Calculator Card */
.calculator-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.calculator-card .card-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Mode Grid */
.mode-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.75rem;
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.mode-btn:hover {
    border-color: var(--brand-primary);
    background-color: var(--bg-tertiary);
    transform: translateY(-2px);
}

.mode-btn.active {
    border-color: var(--brand-primary);
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1) 0%, rgba(8, 145, 178, 0.1) 100%);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

.mode-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-card);
    border-radius: 50%;
    font-size: 1rem;
    color: var(--brand-primary);
}

.mode-btn.active .mode-icon {
    background-color: var(--brand-primary);
    color: white;
}

.mode-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.3;
}

.mode-btn.active .mode-label {
    color: var(--brand-primary);
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.form-input {
    display: block;
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    background-color: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

.form-input::-webkit-outer-spin-button,
.form-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.form-input:focus {
    border-color: var(--brand-primary);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

.input-suffix {
    position: absolute;
    right: 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-muted);
    pointer-events: none;
}

/* Quick Buttons */
.quick-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.quick-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.quick-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.quick-btn:hover {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: white;
    transform: translateY(-1px);
}

/* Buttons */
.btn-block {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--brand-primary);
    border: 2px solid var(--brand-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--brand-secondary);
    border-color: var(--brand-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.875rem 1.5rem;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--border-dark);
}

/* Error Message */
.error-message {
    display: none;
    padding: 1rem;
    background-color: var(--danger-bg);
    color: var(--danger);
    border-radius: var(--radius-md);
    margin-top: 1rem;
    font-weight: 500;
}

.error-message.show {
    display: block;
}

/* Loading */
.loading {
    display: none;
    text-align: center;
    padding: 2rem;
}

.loading.show {
    display: block;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

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

/* Results Section */
.results-section {
    animation: fadeInUp 0.5s ease;
}

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

/* Main Result Card */
.result-card {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem;
    text-align: center;
    color: white;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.result-emoji {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.result-title {
    font-size: 1.1rem;
    font-weight: 600;
    opacity: 0.9;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.result-main {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    z-index: 1;
    margin-bottom: 1rem;
}

.result-number {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1;
    color: #fbbf24;
}

.result-unit {
    font-size: 2rem;
    font-weight: 700;
    opacity: 0.8;
}

.result-explanation {
    font-size: 1.05rem;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 1.25rem;
    position: relative;
    z-index: 1;
}

.copy-result-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1.25rem;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
}

.copy-result-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Visual Percentage Bar */
.percent-bar-container {
    padding: 0.5rem 0;
}

.percent-bar {
    width: 100%;
    height: 40px;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 2px solid var(--border-color);
    position: relative;
}

.percent-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-primary) 0%, #22d3ee 100%);
    border-radius: var(--radius-lg);
    transition: width 1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.percent-bar-text {
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    padding: 0 0.5rem;
}

.percent-bar-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Step by Step Solution */
.solution-box {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.solution-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--brand-primary);
}

.step-number {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--brand-primary);
    color: white;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.step-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    word-break: break-all;
}

/* History */
.clear-history-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.clear-history-btn:hover {
    color: var(--danger);
    background-color: var(--danger-bg);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.history-item:hover {
    border-color: var(--brand-primary);
}

.history-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.history-result {
    font-size: 1rem;
    font-weight: 700;
    color: var(--brand-primary);
}

/* Reference Table */
.reference-table-wrapper {
    overflow-x: auto;
}

.reference-table {
    width: 100%;
    border-collapse: collapse;
}

.reference-table th {
    background-color: var(--brand-primary);
    color: white;
    padding: 0.75rem 1rem;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
}

.reference-table td {
    padding: 0.625rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-primary);
}

.reference-table tbody tr:nth-child(even) {
    background-color: var(--bg-secondary);
}

.reference-table tbody tr:hover {
    background-color: var(--bg-tertiary);
}

/* Info Box */
.info-box {
    padding: 1.25rem;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    border-left: 4px solid var(--brand-primary);
}

.info-box:last-child {
    margin-bottom: 0;
}

.info-box h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.info-box p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0;
    line-height: 1.6;
}

/* FAQ */
.faq-item {
    padding: 1.25rem;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.faq-item:last-child {
    margin-bottom: 0;
}

.faq-question {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.faq-answer {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0;
    line-height: 1.6;
}

/* ============================================
   Export & Share Section
   ============================================ */
.export-share-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.export-row {
    display: flex;
    justify-content: center;
}

.btn-export {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    max-width: 400px;
}

.btn-export:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

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

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

.share-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 0.625rem;
    flex-wrap: wrap;
}

.share-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.share-btn.whatsapp { background-color: #25D366; }
.share-btn.twitter { background-color: #1DA1F2; }
.share-btn.facebook { background-color: #1877F2; }
.share-btn.linkedin { background-color: #0A66C2; }
.share-btn.telegram { background-color: #0088cc; }
.share-btn.copy { background-color: var(--gray-500); }

.share-btn.whatsapp:hover { background-color: #128C7E; }
.share-btn.twitter:hover { background-color: #0d8ecf; }
.share-btn.facebook:hover { background-color: #0d6efd; }
.share-btn.linkedin:hover { background-color: #004182; }
.share-btn.telegram:hover { background-color: #006699; }
.share-btn.copy:hover { background-color: var(--gray-600); }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 991.98px) {
    .mode-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 575.98px) {
    .calculator-card {
        padding: 1.25rem;
    }

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

    .mode-btn {
        padding: 0.75rem 0.5rem;
    }

    .mode-label {
        font-size: 0.7rem;
    }

    .mode-icon {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    .result-number {
        font-size: 2.5rem;
    }

    .result-unit {
        font-size: 1.5rem;
    }

    .result-card {
        padding: 1.5rem 1rem;
    }

    .quick-buttons {
        gap: 0.375rem;
    }

    .quick-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    .btn-export {
        font-size: 0.9rem;
        padding: 0.75rem 1.5rem;
    }

    .share-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .solution-step {
        flex-direction: column;
        gap: 0.5rem;
    }
}
