/* ================================================
   CALCULATOR SYSTEM CSS
   Version: 4.0 - Complete Redesign
   Description: Modern, professional calculator interface
   Inherits: style.css global variables
   ================================================ */

/* ================================================
   CALCULATOR PAGE LAYOUT
   ================================================ */

.calculator-page {
    min-height: calc(100vh - var(--navbar-height));
    background: var(--bg-light);
    padding: var(--space-12) 0;
}

.calculator-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

/* ================================================
   PAGE HEADER
   ================================================ */

.calculator-header {
    text-align: center;
    margin-bottom: var(--space-12);
    padding: var(--space-8) 0;
}

.calculator-title {
    font-size: var(--text-4xl);
    font-weight: var(--font-extrabold);
    color: var(--text-primary);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    line-height: var(--leading-tight);
}

.calculator-title i {
    font-size: 0.9em;
    color: var(--primary-blue);
}

.calculator-description {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto;
    line-height: var(--leading-relaxed);
}

/* ================================================
   CALCULATOR GRID LAYOUT
   ================================================ */

.calculator-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-8);
}

@media (min-width: 992px) {
    .calculator-grid {
        grid-template-columns: 2fr 1fr;
        gap: var(--space-10);
    }
}

/* ================================================
   CALCULATOR CARD (Form Container)
   ================================================ */

.calculator-card {
    background: var(--bg-white);
    border-radius: var(--radius-2xl);
    padding: var(--space-10);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    margin-bottom: var(--space-8);
}

.calculator-card-title {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-8);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding-bottom: var(--space-5);
    border-bottom: 2px solid var(--border-light);
}

.calculator-card-title i {
    font-size: 0.85em;
    color: var(--primary-blue);
}

/* ================================================
   FORM ELEMENTS
   ================================================ */

.calculator-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-label {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.form-label-required::after {
    content: '*';
    color: var(--error-red);
    margin-left: var(--space-1);
}

/* Input Wrapper */
.form-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

/* Input Styles */
.form-input,
.form-select {
    width: 100%;
    padding: 14px 18px;
    font-size: var(--text-base);
    font-family: var(--font-primary);
    color: var(--text-primary);
    background: var(--bg-white);
    border: 2px solid var(--border-default);
    border-radius: var(--radius-xl);
    transition: all var(--transition-base);
    outline: none;
}

.form-input:hover,
.form-select:hover {
    border-color: var(--primary-blue);
}

.form-input:focus,
.form-select:focus {
    border-color: var(--primary-blue);
    background: var(--bg-white);
    box-shadow: 0 0 0 4px rgba(0, 97, 255, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* Input with Icon */
.form-input-wrapper .form-input {
    padding-right: 50px;
}

.form-input-icon {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
    pointer-events: none;
}

/* Select Dropdown */
.form-select {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 20px;
    padding-right: 45px;
}

.form-select:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%230061ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* Help Text */
.form-help-text {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    line-height: var(--leading-normal);
}

/* Error State */
.form-input.has-error,
.form-select.has-error {
    border-color: var(--error-red);
    background: var(--bg-error-light);
}

.form-error {
    font-size: var(--text-xs);
    color: var(--error-red);
    margin-top: var(--space-1);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.form-error::before {
    content: '⚠';
}

/* ================================================
   FORM BUTTONS
   ================================================ */

.btn-calculate,
.btn-reset {
    width: 100%;
    padding: 16px 24px;
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-xl);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-family: var(--font-primary);
}

.btn-calculate {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-dark) 100%);
    color: var(--text-white);
    box-shadow: 0 4px 16px rgba(0, 97, 255, 0.3);
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 97, 255, 0.4);
}

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

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

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

.btn-reset:hover {
    background: var(--bg-light);
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

/* Loading Spinner */
.btn-calculate .spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--text-white);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.btn-calculate.loading .spinner {
    display: inline-block;
}

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

/* ================================================
   RESULTS PANEL
   ================================================ */

.results-panel {
    background: linear-gradient(135deg, rgba(0, 97, 255, 0.03) 0%, rgba(0, 82, 217, 0.05) 100%);
    border: 2px solid rgba(0, 97, 255, 0.15);
    border-radius: var(--radius-2xl);
    padding: var(--space-10);
    margin-bottom: var(--space-8);
    animation: fadeInUp 0.4s ease;
}

.results-panel.hidden {
    display: none;
}

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

.results-title {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-8);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding-bottom: var(--space-5);
    border-bottom: 2px solid rgba(0, 97, 255, 0.15);
}

.results-title i {
    font-size: 0.9em;
    color: var(--accent-green);
}

/* Results Breakdown */
.results-breakdown {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-5);
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    transition: all var(--transition-base);
}

.result-item:hover {
    border-color: rgba(0, 97, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 97, 255, 0.08);
}

.result-item.highlight {
    background: linear-gradient(135deg, rgba(0, 97, 255, 0.05) 0%, rgba(0, 82, 217, 0.08) 100%);
    border-color: rgba(0, 97, 255, 0.25);
}

.result-item.total {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-dark) 100%);
    border: none;
    padding: var(--space-6) var(--space-5);
    margin-top: var(--space-4);
    box-shadow: 0 4px 16px rgba(0, 97, 255, 0.25);
}

.result-item.total .result-label,
.result-item.total .result-value {
    color: var(--text-white);
}

/* Result Label */
.result-label {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.result-label > span:first-child {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-primary);
}

.result-item.total .result-label > span:first-child {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
}

.result-percentage {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    font-weight: var(--font-normal);
}

.result-item.total .result-percentage {
    color: rgba(255, 255, 255, 0.8);
}

/* Result Value */
.result-value {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--primary-blue);
    white-space: nowrap;
}

.result-item.total .result-value {
    font-size: var(--text-3xl);
    color: var(--text-white);
}

/* ================================================
   ALERTS
   ================================================ */

.alert {
    padding: var(--space-5);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-6);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    animation: fadeInDown 0.3s ease;
}

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

.alert i {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-error {
    background: var(--bg-error-light);
    border: 2px solid var(--error-red);
    color: #991b1b;
}

.alert-error i {
    color: var(--error-red);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 2px solid var(--accent-green);
    color: #065f46;
}

.alert-success i {
    color: var(--accent-green);
}

.alert-warning {
    background: rgba(234, 179, 8, 0.1);
    border: 2px solid var(--warning-yellow);
    color: #713f12;
}

.alert-warning i {
    color: var(--warning-yellow);
}

.alert-info {
    background: rgba(0, 97, 255, 0.08);
    border: 2px solid rgba(0, 97, 255, 0.3);
    color: #1e40af;
}

.alert-info i {
    color: var(--primary-blue);
}

/* ================================================
   SIDEBAR
   ================================================ */

.calculator-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

/* Info Card */
.info-card {
    background: var(--bg-white);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.info-card-title {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding-bottom: var(--space-4);
    border-bottom: 2px solid var(--border-light);
}

.info-card-title i {
    font-size: 1em;
    color: var(--accent-orange);
}

.info-card-content {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
}

.info-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.info-list li {
    padding-left: var(--space-6);
    position: relative;
    line-height: var(--leading-relaxed);
}

.info-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--accent-green);
    font-weight: var(--font-bold);
    font-size: 1.1em;
}

/* ================================================
   CONTENT SECTIONS
   ================================================ */

.calculator-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

.content-section {
    background: var(--bg-white);
    border-radius: var(--radius-2xl);
    padding: var(--space-10);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.content-section h2 {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 2px solid var(--border-light);
}

.content-section h3 {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin-top: var(--space-6);
    margin-bottom: var(--space-4);
}

.content-section h4 {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--primary-blue);
    margin-top: var(--space-4);
    margin-bottom: var(--space-2);
}

.content-section p {
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-4);
}

.content-section ul,
.content-section ol {
    padding-left: var(--space-8);
    margin-bottom: var(--space-5);
    color: var(--text-secondary);
}

.content-section li {
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-2);
}

.content-section strong {
    color: var(--text-primary);
    font-weight: var(--font-semibold);
}

/* FAQ Items */
.faq-item {
    padding: var(--space-5);
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
    border-left: 4px solid var(--primary-blue);
}

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

.faq-item h4 {
    margin-top: 0;
    margin-bottom: var(--space-3);
}

.faq-item p {
    margin-bottom: 0;
}

/* ================================================
   RESPONSIVE DESIGN - TABLET
   ================================================ */

@media (max-width: 991px) {
    .calculator-page {
        padding: var(--space-8) 0;
    }

    .calculator-header {
        margin-bottom: var(--space-8);
        padding: var(--space-5) 0;
    }

    .calculator-title {
        font-size: var(--text-3xl);
    }

    .calculator-card,
    .results-panel,
    .content-section {
        padding: var(--space-8);
    }
}

/* ================================================
   RESPONSIVE DESIGN - MOBILE
   ================================================ */

@media (max-width: 767px) {
    .calculator-page {
        padding: var(--space-6) 0;
    }

    .calculator-header {
        margin-bottom: var(--space-6);
        padding: var(--space-4) 0;
    }

    .calculator-title {
        font-size: var(--text-2xl);
        flex-direction: column;
        gap: var(--space-2);
    }

    .calculator-title i {
        font-size: 1.2em;
    }

    .calculator-description {
        font-size: var(--text-base);
    }

    .calculator-grid {
        gap: var(--space-6);
    }

    .calculator-card,
    .results-panel,
    .content-section,
    .info-card {
        padding: var(--space-6);
        border-radius: var(--radius-xl);
    }

    .calculator-card-title,
    .results-title {
        font-size: var(--text-xl);
        margin-bottom: var(--space-6);
    }

    .form-input,
    .form-select {
        padding: 12px 16px;
        font-size: var(--text-sm);
    }

    .btn-calculate,
    .btn-reset {
        padding: 14px 20px;
        font-size: var(--text-sm);
    }

    .result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
        padding: var(--space-4);
    }

    .result-value {
        font-size: var(--text-lg);
    }

    .result-item.total .result-value {
        font-size: var(--text-2xl);
    }

    .content-section h2 {
        font-size: var(--text-xl);
    }

    .content-section h3 {
        font-size: var(--text-lg);
    }
}

/* ================================================
   PRINT STYLES
   ================================================ */

@media print {
    .calculator-page {
        background: white;
        padding: 0;
    }

    .calculator-header,
    .calculator-form,
    .btn-reset,
    .btn-calculate,
    .calculator-sidebar,
    .info-card {
        display: none;
    }

    .results-panel {
        border: 2px solid #000;
        box-shadow: none;
        page-break-inside: avoid;
    }

    .result-item {
        border: 1px solid #000;
    }
}

/* ================================================
   ACCESSIBILITY ENHANCEMENTS
   ================================================ */

/* Focus Visible */
.form-input:focus-visible,
.form-select:focus-visible,
.btn-calculate:focus-visible,
.btn-reset:focus-visible {
    outline: 3px solid var(--primary-blue);
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast */
@media (prefers-contrast: high) {
    .form-input,
    .form-select {
        border-width: 3px;
    }

    .calculator-card,
    .results-panel,
    .info-card {
        border-width: 2px;
    }
}

/* ================================================
   UTILITY CLASSES
   ================================================ */

.hidden {
    display: none !important;
}

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

.mt-4 {
    margin-top: var(--space-4);
}

.mb-4 {
    margin-bottom: var(--space-4);
}

.gap-4 {
    gap: var(--space-4);
}

.flex {
    display: flex;
}

.flex-1 {
    flex: 1;
}

/* ================================================
   END OF CALCULATOR CSS
   ================================================ */