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

/* Font Face Declarations */
@font-face {
    font-family: 'Peyda';
    src: url('../font/Peyda-Thin.ttf') format('truetype');
    font-weight: 100;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Peyda';
    src: url('../font/Peyda-ExtraLight.ttf') format('truetype');
    font-weight: 200;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Peyda';
    src: url('../font/Peyda-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Peyda';
    src: url('../font/Peyda-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Peyda';
    src: url('../font/Peyda-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Peyda';
    src: url('../font/Peyda-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Peyda';
    src: url('../font/Peyda-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Peyda';
    src: url('../font/Peyda-ExtraBold.ttf') format('truetype');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Peyda';
    src: url('../font/Peyda-Black.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

/* Plugin Base Styles */
:root {
    /* Colors */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #3b82f6;
    --secondary-hover: #2563eb;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --background-color: #ffffff;
    --input-background: #F3F4F6;
    --result-background: #F3F4F6;
    --hover-color: #f3f4f6;
    --shadow-color: rgba(0, 0, 0, 0.05);
    
    /* Typography */
    --font-family: 'Peyda', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-base: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 20px;
    --font-size-2xl: 24px;
    --font-size-3xl: 30px;
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
    
    /* Spacing */
    --spacing-0: 0;
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    --spacing-3xl: 64px;
    
    /* Border */
    --border-width: 1px;
    --border-width-2: 2px;
    --border-radius-sm: 6px;
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 20px;
    --border-radius-full: 9999px;
    
    /* Shadow */
    --shadow-sm: 0 1px 2px var(--shadow-color);
    --shadow-md: 0 4px 6px -1px var(--shadow-color);
    --shadow-lg: 0 10px 15px -3px var(--shadow-color);
    --shadow-xl: 0 20px 25px -5px var(--shadow-color);
    
    /* Transition */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Z-index */
    --z-index-dropdown: 1000;
    --z-index-sticky: 1020;
    --z-index-fixed: 1030;
    --z-index-modal: 1040;
    --z-index-popover: 1050;
    --z-index-tooltip: 1060;
}

/* Base Styles */
html {
    direction: rtl;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    color: var(--text-color);
    background-color: var(--background-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Global Font Settings */
* {
    font-family: var(--font-family);
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Calculator Container */
.mamd-calculator-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-xl);
    background-color: var(--background-color);
    min-height: 100vh;
}

/* Header Section */
.calculator-header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-lg) 0;
}

.calculator-title {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--primary-color);
    margin-bottom: var(--spacing-md);
    line-height: var(--line-height-tight);
}

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

/* Calculator Grid */
.calculator-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    background-color: var(--input-background);
    border-radius: 10px;
    padding: var(--spacing-xl);
}

/* Form Section */
.calculator-form {
    background-color: transparent;
    padding: 0;
    box-shadow: none;
}

.calculator-form:hover {
    transform: none;
    box-shadow: none;
}

.car-calc-field {
    margin-bottom: var(--spacing-lg);
}

.car-calc-field:last-child {
    margin-bottom: 0;
}

.car-calc-field label {
    display: block;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    color: var(--text-color);
    margin-bottom: var(--spacing-sm);
    text-align: right;
}

/* Number Formatting */
[class*="result-value"],
[class*="price"],
[class*="amount"],
[class*="payment"],
[class*="total"],
input[type="text"],
input[type="number"],
select,
.car-calc-field input,
.car-calc-field select,
.result-value,
.currency {
    font-family: 'Peyda', monospace !important;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
    direction: rtl;
    text-align: right;
    cursor: text;
    font-variant-numeric: tabular-nums;
    -moz-font-feature-settings: "tnum";
    -webkit-font-feature-settings: "tnum";
    font-feature-settings: "tnum";
}

/* Input Fields */
.car-calc-field input,
.car-calc-field select {
    width: 100%;
    padding: var(--spacing-md);
    border: var(--border-width) solid var(--border-color);
    border-radius: 10px;
    font-size: var(--font-size-base);
    color: var(--text-color);
    background-color: var(--input-background);
    transition: all var(--transition-fast);
    text-align: right;
    direction: rtl;
}

.car-calc-field input:hover,
.car-calc-field select:hover {
    border-color: var(--primary-color);
}

.car-calc-field input:focus,
.car-calc-field select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Results Section */
.calculator-results {
    background-color: transparent;
    padding: 0;
    box-shadow: none;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    border-bottom: var(--border-width) solid var(--border-color);
    transition: background-color var(--transition-fast);
    margin-bottom: var(--spacing-sm);
    background-color: var(--input-background);
    border-radius: 10px;
}

.result-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.result-item:hover {
    background-color: var(--hover-color);
}

.result-label {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    color: var(--text-color);
    text-align: right;
}

.result-value {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--primary-color);
    text-align: right;
    direction: rtl;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

/* Total Result Item */
.result-item.total {
    background-color: var(--primary-color);
    color: white;
    border-radius: 10px;
    margin-top: var(--spacing-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
}

.result-item.total .result-label {
    color: white;
    font-weight: var(--font-weight-semibold);
}

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

/* Disabled States */
.car-calc-field input:disabled,
.car-calc-field select:disabled {
    background-color: var(--background-color);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Loading State */
.calculator-loading {
    display: none;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-xl);
}

.calculator-loading.active {
    display: flex;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error Messages */
.error-message {
    display: none;
    color: var(--error-color);
    font-size: var(--font-size-sm);
    margin-top: var(--spacing-sm);
    text-align: right;
}

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

/* Placeholder Styles */
::placeholder {
    color: var(--text-light);
    opacity: 0.7;
    text-align: right;
    direction: rtl;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .calculator-container {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }
}

@media (max-width: 768px) {
    .calculator-container {
        padding: var(--spacing-lg);
    }
}

@media (max-width: 480px) {
    .calculator-container {
        padding: var(--spacing-md);
    }
    
    .result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }
    
    .result-value {
        width: 100%;
        text-align: right;
    }
}

/* Print Styles */
@media print {
    .calculator-form,
    .calculator-results {
        box-shadow: none;
        border: var(--border-width) solid var(--border-color);
    }
    
    .calculator-info {
        display: none;
    }
    
    .car-calc-field input,
    .car-calc-field select {
        border: var(--border-width) solid var(--border-color);
    }
    
    [class*="result-value"],
    [class*="price"],
    [class*="amount"],
    [class*="payment"],
    [class*="total"],
    input[type="text"],
    input[type="number"],
    select,
    .result-value,
    .currency {
        font-family: 'Peyda', monospace !important;
        cursor: default;
        font-variant-numeric: tabular-nums;
        -moz-font-feature-settings: "tnum";
        -webkit-font-feature-settings: "tnum";
        font-feature-settings: "tnum";
        direction: rtl;
        text-align: right;
    }
    
    .currency::after {
        content: "تومان";
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0000ff;
        --secondary-color: #0000ff;
        --text-color: #000000;
        --border-color: #000000;
        --background-color: #ffffff;
    }
    
    .result-item.total {
        border: var(--border-width-2) solid #000000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .loading-spinner {
        animation: none;
    }
}

/* Touch Device Optimization */
@media (hover: none) {
    .calculator-form:hover,
    .calculator-results:hover,
    .result-item:hover {
        transform: none;
        box-shadow: var(--shadow-lg);
    }
}

/* RTL Specific Fixes */
.car-calc-field input[type="number"] {
    direction: rtl;
    text-align: right;
}

.car-calc-field select {
    text-align: right;
    padding-right: var(--spacing-md);
}

.car-calc-field select option {
    text-align: right;
}

/* Currency Format */
.currency {
    margin-right: var(--spacing-xs);
    font-weight: var(--font-weight-medium);
    display: inline-block;
}

.currency::after {
    content: "تومان";
    margin-right: var(--spacing-xs);
    font-weight: var(--font-weight-medium);
} 