/* Percentage Calculator - Fully Responsive with Day/Night Mode */

/* Import fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

/* ====================== PERCENTAGE CALCULATOR STYLES ====================== */

.percentage-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
    font-family: 'Poppins', sans-serif;
}

.percentage-wrapper {
    max-width: 900px;
    margin: 0 auto;
}

.percentage-title {
    font-size: 3rem;
    font-weight: 800;
    font-family: 'Poppins', sans-serif;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--text);
    letter-spacing: -0.02em;
}

.percentage-heart {
    font-size: 2.8rem;
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.percentage-subtitle {
    text-align: center;
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 2.5rem;
    font-family: 'Poppins', sans-serif;
}

.percentage-card {
    background: var(--surface);
    border-radius: var(--radius, 16px);
    border: 1px solid var(--border);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

/* Tabs */
.percentage-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.percentage-tab {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-light);
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.percentage-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.percentage-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Calculator Sections */
.percentage-calculator {
    display: none;
    animation: fadeIn 0.4s ease;
}

.percentage-calculator.active {
    display: block;
}

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

.calculator-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text);
    font-family: 'Poppins', sans-serif;
}

.calculator-title .highlight {
    color: var(--primary);
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Input Groups */
.input-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.input-field {
    display: flex;
    flex-direction: column;
}

.input-field label {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.percentage-input {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    width: 100%;
}

.percentage-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Result Area */
.result-area {
    background: var(--bg);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

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

.result-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    font-family: 'Poppins', sans-serif;
}

/* Calculation Explanation */
.calculation-explanation {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 1rem;
    color: var(--text-light);
    font-size: 0.95rem;
    font-family: 'Courier New', monospace;
    margin-top: 1rem;
    word-break: break-word;
}

/* Action Buttons */
.percentage-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.percentage-action-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    flex: 1;
    text-align: center;
}

.percentage-action-btn:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.percentage-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Download Button */
.percentage-action-btn.download-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: #10b981;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.percentage-action-btn.download-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    border-color: #059669;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3);
}

/* Fun Fact */
.percentage-funfact {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    text-align: center;
    font-weight: 600;
    margin: 2rem auto;
    max-width: 600px;
    box-shadow: var(--shadow);
    font-size: 1rem;
}

/* Reference Table */
.percentage-reference {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 2rem;
    margin: 3rem 0;
    overflow-x: auto;
}

.percentage-reference h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text);
    font-family: 'Poppins', sans-serif;
}

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

.percentage-table th {
    text-align: left;
    padding: 1rem;
    background: var(--bg);
    color: var(--text);
    font-weight: 600;
    border-bottom: 2px solid var(--border);
}

.percentage-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-light);
}

.percentage-table tr:hover td {
    background: var(--bg);
}

/* Download Card Container */
.download-card-container {
    margin-top: 2rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px dashed var(--primary);
    position: relative;
    display: none;
}

.download-card-container.active {
    display: block;
    animation: slideUp 0.3s ease;
}

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

/* Download Card */
.download-card {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    border-radius: 24px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.2);
    max-width: 500px;
    margin: 0 auto;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.dark-mode .download-card {
    background: linear-gradient(135deg, #1e1e2e, #2d2d44);
    border: 1px solid rgba(99, 102, 241, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Decorative Background */
.download-card-bg-decoration {
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 0;
}

.download-card-corner-decoration {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, transparent 100%);
    border-radius: 0 100px 0 0;
    z-index: 0;
}

/* Card Header */
.download-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
    gap: 1rem;
}

.download-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.download-logo-icon {
    font-size: 1.8rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: white;
}

.download-logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

.download-date {
    font-size: 0.85rem;
    color: var(--text-light);
    background: var(--bg);
    padding: 0.3rem 1rem;
    border-radius: 50px;
    border: 1px solid var(--border);
}

/* Card Body */
.download-card-body {
    position: relative;
    z-index: 1;
}

.download-calculator-type {
    font-size: 1rem;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.download-calculation {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 1.5rem;
    font-family: 'Poppins', sans-serif;
    word-break: break-word;
}

.download-result-box {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.download-result-label {
    display: block;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.download-result-value {
    font-size: 3rem;
    font-weight: 800;
    color: white;
    font-family: 'Poppins', sans-serif;
    line-height: 1.2;
    word-break: break-word;
}

.download-explanation {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    color: var(--text);
    text-align: center;
    word-break: break-word;
}

.download-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.download-input-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem;
    text-align: center;
}

.download-input-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.download-input-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    word-break: break-word;
}

/* Card Footer */
.download-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.download-timestamp {
    font-size: 0.8rem;
    color: var(--text-light);
}

.download-brand {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
}

/* Download Controls */
.download-controls {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.download-btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.download-btn-primary:hover {
    background: var(--primary-light, #818cf8);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.download-btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.8rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.download-btn-secondary:hover {
    background: var(--surface);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

/* SEO Section */
.percentage-seo {
    margin: 4rem 0;
    padding: 2rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.percentage-seo h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text);
    font-family: 'Poppins', sans-serif;
}

.percentage-seo h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 1.5rem 0 1rem;
    color: var(--text);
}

.percentage-seo p {
    color: var(--text-light);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.percentage-howto-list,
.percentage-features-list {
    padding-left: 1.5rem;
    margin: 1rem 0;
}

.percentage-howto-list li,
.percentage-features-list li {
    color: var(--text-light);
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.percentage-howto-list li::marker,
.percentage-features-list li::marker {
    color: var(--primary);
}

/* ====================== RESPONSIVE DESIGN ====================== */

/* Tablet Styles (768px to 1024px) */
@media screen and (max-width: 1024px) {
    .percentage-container {
        padding: 0 1.5rem;
        margin: 1.5rem auto;
    }

    .percentage-title {
        font-size: 2.5rem;
    }

    .percentage-heart {
        font-size: 2.3rem;
    }

    .percentage-card {
        padding: 1.5rem;
    }
}

/* Mobile Landscape & Tablet Portrait (481px to 768px) */
@media screen and (max-width: 768px) {
    .percentage-container {
        padding: 0 1rem;
        margin: 1rem auto;
    }

    .percentage-title {
        font-size: 2rem;
    }

    .percentage-heart {
        font-size: 1.8rem;
    }

    .percentage-subtitle {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }

    .percentage-card {
        padding: 1.2rem;
    }

    .percentage-tab {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .calculator-title {
        font-size: 1.3rem;
    }

    .input-group {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .result-area {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

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

    .calculation-explanation {
        font-size: 0.85rem;
    }

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

    .percentage-action-btn {
        width: 100%;
    }

    .percentage-funfact {
        font-size: 0.85rem;
        padding: 0.8rem 1rem;
        border-radius: 30px;
    }

    .percentage-reference {
        padding: 1.5rem;
    }

    .percentage-reference h3 {
        font-size: 1.2rem;
    }

    .percentage-table th,
    .percentage-table td {
        padding: 0.75rem;
        font-size: 0.85rem;
    }

    .download-card {
        padding: 1.5rem;
    }

    .download-calculation {
        font-size: 1.3rem;
    }

    .download-result-value {
        font-size: 2rem;
    }

    .download-inputs {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .download-card-header {
        flex-direction: column;
        text-align: center;
    }

    .download-controls {
        flex-direction: column;
    }

    .download-btn-primary,
    .download-btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .percentage-seo {
        padding: 1.5rem;
    }

    .percentage-seo h2 {
        font-size: 1.5rem;
    }

    .percentage-seo h3 {
        font-size: 1.1rem;
    }

    .percentage-seo p,
    .percentage-howto-list li,
    .percentage-features-list li {
        font-size: 0.9rem;
    }
}

/* Mobile Portrait (up to 480px) */
@media screen and (max-width: 480px) {
    .percentage-container {
        padding: 0 0.75rem;
        margin: 0.75rem auto;
    }

    .percentage-title {
        font-size: 1.5rem;
    }

    .percentage-heart {
        font-size: 1.3rem;
    }

    .percentage-subtitle {
        font-size: 0.85rem;
    }

    .percentage-card {
        padding: 1rem;
        border-radius: 12px;
    }

    .percentage-tabs {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
        border-bottom: none;
        padding-bottom: 0;
    }

    .percentage-tab {
        width: 100%;
        text-align: center;
        padding: 0.6rem;
    }

    .calculator-title {
        font-size: 1.1rem;
        text-align: center;
    }

    .input-field label {
        font-size: 0.8rem;
    }

    .percentage-input {
        padding: 0.7rem;
        font-size: 0.95rem;
    }

    .result-label {
        font-size: 0.9rem;
    }

    .result-value {
        font-size: 1.3rem;
    }

    .calculation-explanation {
        font-size: 0.75rem;
        padding: 0.8rem;
    }

    .percentage-funfact {
        font-size: 0.75rem;
        padding: 0.6rem 0.8rem;
    }

    .percentage-table th,
    .percentage-table td {
        padding: 0.6rem;
        font-size: 0.75rem;
    }

    .download-card {
        padding: 1rem;
    }

    .download-calculation {
        font-size: 1.1rem;
    }

    .download-result-value {
        font-size: 1.5rem;
    }

    .download-result-box {
        padding: 1rem;
    }

    .download-explanation {
        font-size: 0.75rem;
    }

    .download-input-value {
        font-size: 0.9rem;
    }

    .percentage-seo h2 {
        font-size: 1.2rem;
    }

    .percentage-seo h3 {
        font-size: 1rem;
    }

    .percentage-seo p,
    .percentage-howto-list li,
    .percentage-features-list li {
        font-size: 0.85rem;
    }
}

/* Extra Small Devices (up to 360px) */
@media screen and (max-width: 360px) {
    .percentage-title {
        font-size: 1.3rem;
    }

    .percentage-heart {
        font-size: 1.1rem;
    }

    .result-value {
        font-size: 1.1rem;
    }

    .download-result-value {
        font-size: 1.2rem;
    }

    .download-calculation {
        font-size: 0.95rem;
    }
}

/* Touch-friendly improvements for mobile devices */
@media (hover: none) and (pointer: coarse) {
    .percentage-tab,
    .percentage-action-btn,
    .download-btn-primary,
    .download-btn-secondary {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .percentage-action-btn:active,
    .download-btn-primary:active {
        transform: scale(0.98);
    }
}

/* Print styles */
@media print {
    .percentage-tabs,
    .percentage-actions,
    .percentage-funfact,
    .percentage-reference,
    .download-controls,
    .percentage-seo {
        display: none;
    }

    .percentage-container {
        padding: 0;
        margin: 0;
    }

    .percentage-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Smooth transitions */
* {
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

/* Dark mode specific adjustments */
@media (prefers-color-scheme: dark) {
    .percentage-card {
        background: var(--surface);
    }
}

/* Scrollbar styling */
.percentage-input::-webkit-scrollbar,
.calculation-explanation::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.percentage-input::-webkit-scrollbar-track,
.calculation-explanation::-webkit-scrollbar-track {
    background: var(--border);
    border-radius: 4px;
}

.percentage-input::-webkit-scrollbar-thumb,
.calculation-explanation::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}