/* حاسبة تكلفة مشروع القهوة المختصة - تنسيقات الواجهة الأمامية */

/* المتغيرات الأساسية */
:root {
    --coffee-primary: #8B4513;
    --coffee-secondary: #D2691E;
    --coffee-accent: #CD853F;
    --coffee-light: #F5DEB3;
    --coffee-dark: #654321;
    --coffee-white: #FFFFFF;
    --coffee-gray-light: #F8F9FA;
    --coffee-gray: #6C757D;
    --coffee-gray-dark: #343A40;
    --coffee-success: #28A745;
    --coffee-error: #DC3545;
    --coffee-warning: #FFC107;
    
    --coffee-border-radius: 12px;
    --coffee-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --coffee-shadow-hover: 0 8px 15px rgba(0, 0, 0, 0.2);
    --coffee-transition: all 0.3s ease;
    
    --coffee-font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --coffee-font-size-base: 16px;
    --coffee-font-size-small: 14px;
    --coffee-font-size-large: 18px;
    --coffee-font-size-xl: 24px;
}

/* إعادة تعيين الأساسيات */
.coffee-calculator-container * {
    box-sizing: border-box;
}

/* الحاوي الرئيسي */
.coffee-calculator-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: var(--coffee-font-family);
    font-size: var(--coffee-font-size-base);
    line-height: 1.6;
    color: var(--coffee-gray-dark);
    direction: rtl;
    text-align: right;
}

/* رأس الحاسبة */
.coffee-calc-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: linear-gradient(135deg, var(--coffee-primary), var(--coffee-secondary));
    border-radius: var(--coffee-border-radius);
    color: var(--coffee-white);
    box-shadow: var(--coffee-shadow);
}

.coffee-calc-title {
    font-size: var(--coffee-font-size-xl);
    font-weight: 700;
    margin: 0 0 15px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.coffee-calc-description {
    font-size: var(--coffee-font-size-base);
    margin: 0;
    opacity: 0.9;
}

/* النموذج */
.coffee-calc-form {
    background: var(--coffee-white);
    border-radius: var(--coffee-border-radius);
    padding: 30px;
    box-shadow: var(--coffee-shadow);
    margin-bottom: 30px;
}

.coffee-calc-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

@media (max-width: 768px) {
    .coffee-calc-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* الحقول */
.coffee-calc-field {
    position: relative;
}

.coffee-calc-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--coffee-dark);
    font-size: var(--coffee-font-size-base);
}

.coffee-calc-field label i {
    margin-left: 8px;
    color: var(--coffee-primary);
}

.required {
    color: var(--coffee-error);
    margin-right: 4px;
}

.coffee-calc-field input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #E9ECEF;
    border-radius: var(--coffee-border-radius);
    font-size: var(--coffee-font-size-base);
    transition: var(--coffee-transition);
    background: var(--coffee-white);
    direction: rtl;
}

.coffee-calc-field input:focus {
    outline: none;
    border-color: var(--coffee-primary);
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

.coffee-calc-field input:invalid {
    border-color: var(--coffee-error);
}

.field-error {
    color: var(--coffee-error);
    font-size: var(--coffee-font-size-small);
    margin-top: 5px;
    display: none;
}

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

/* الأزرار */
.coffee-calc-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

@media (max-width: 768px) {
    .coffee-calc-actions {
        flex-direction: column;
    }
}

.coffee-calc-button {
    padding: 12px 24px;
    border: none;
    border-radius: var(--coffee-border-radius);
    font-size: var(--coffee-font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: var(--coffee-transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 140px;
    text-decoration: none;
}

.coffee-calc-button.primary {
    background: linear-gradient(135deg, var(--coffee-primary), var(--coffee-secondary));
    color: var(--coffee-white);
    box-shadow: var(--coffee-shadow);
}

.coffee-calc-button.primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--coffee-shadow-hover);
}

.coffee-calc-button.secondary {
    background: var(--coffee-white);
    color: var(--coffee-primary);
    border: 2px solid var(--coffee-primary);
}

.coffee-calc-button.secondary:hover {
    background: var(--coffee-primary);
    color: var(--coffee-white);
}

.coffee-calc-button.small {
    padding: 8px 16px;
    font-size: var(--coffee-font-size-small);
    min-width: auto;
}

.coffee-calc-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* أيقونات التحميل */
.coffee-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* النتائج */
.coffee-calc-results {
    background: var(--coffee-white);
    border-radius: var(--coffee-border-radius);
    box-shadow: var(--coffee-shadow);
    overflow: hidden;
    animation: slideIn 0.5s ease-out;
}

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

.results-header {
    background: linear-gradient(135deg, var(--coffee-light), var(--coffee-accent));
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #E9ECEF;
}

.results-header h3 {
    margin: 0;
    color: var(--coffee-dark);
    font-size: var(--coffee-font-size-large);
}

.results-actions {
    display: flex;
    gap: 10px;
}

.results-content {
    padding: 30px;
}

/* بطاقات النتائج */
.result-section {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--coffee-gray-light);
    border-radius: var(--coffee-border-radius);
    border-right: 4px solid var(--coffee-primary);
}

.result-section h4 {
    margin: 0 0 15px 0;
    color: var(--coffee-dark);
    font-size: var(--coffee-font-size-large);
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.result-item {
    background: var(--coffee-white);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--coffee-transition);
}

.result-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--coffee-shadow);
}

.result-label {
    font-weight: 600;
    color: var(--coffee-gray-dark);
}

.result-value {
    font-weight: 700;
    color: var(--coffee-primary);
    font-size: var(--coffee-font-size-large);
}

.result-total {
    background: linear-gradient(135deg, var(--coffee-primary), var(--coffee-secondary));
    color: var(--coffee-white);
    padding: 20px;
    border-radius: var(--coffee-border-radius);
    text-align: center;
    margin-top: 20px;
}

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

/* الرسوم البيانية */
.results-charts {
    padding: 30px;
    border-top: 1px solid #E9ECEF;
    background: var(--coffee-gray-light);
}

.results-charts h4 {
    margin: 0 0 20px 0;
    color: var(--coffee-dark);
    text-align: center;
}

.charts-container {
    max-width: 400px; /* Crucial for chart sizing */
    margin: 0 auto;
}

/* رسائل الخطأ */
.coffee-calc-error {
    background: var(--coffee-error);
    color: var(--coffee-white);
    padding: 15px 20px;
    border-radius: var(--coffee-border-radius);
    margin-top: 20px;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.error-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* الثيم الداكن */
.coffee-calculator-container[data-theme="dark"] {
    background: var(--coffee-gray-dark);
    color: var(--coffee-white);
}

.coffee-calculator-container[data-theme="dark"] .coffee-calc-form,
.coffee-calculator-container[data-theme="dark"] .coffee-calc-results {
    background: #2C3E50;
    color: var(--coffee-white);
}

.coffee-calculator-container[data-theme="dark"] .coffee-calc-field input {
    background: #34495E;
    border-color: #4A5F7A;
    color: var(--coffee-white);
}

.coffee-calculator-container[data-theme="dark"] .result-section {
    background: #34495E;
}

.coffee-calculator-container[data-theme="dark"] .result-item {
    background: #2C3E50;
}

/* تأثيرات إضافية */
.coffee-calc-field {
    position: relative;
    overflow: hidden;
}

.coffee-calc-field::before {
    content: '';
    position: absolute;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: right 0.5s;
}

.coffee-calc-field:hover::before {
    right: 100%;
}

/* تحسينات الطباعة */
@media print {
    .coffee-calc-form,
    .results-actions,
    .coffee-calc-button {
        display: none !important;
    }
    
    .coffee-calculator-container {
        max-width: none;
        padding: 0;
    }
    
    .coffee-calc-results {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* تحسينات إضافية للجوال */
@media (max-width: 480px) {
    .coffee-calculator-container {
        padding: 10px;
    }
    
    .coffee-calc-header {
        padding: 20px;
    }
    
    .coffee-calc-form {
        padding: 20px;
    }
    
    .results-content {
        padding: 20px;
    }
    
    .result-grid {
        grid-template-columns: 1fr;
    }
}


/* أنماط جدول المعدات */
.equipment-details-section {
    margin-top: 30px;
    border: 2px solid var(--coffee-accent);
    border-radius: var(--coffee-border-radius);
    overflow: hidden;
}

.equipment-table-container {
    overflow-x: auto;
}

.equipment-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--coffee-font-size-base);
}

.equipment-table th {
    background: var(--coffee-primary);
    color: var(--coffee-white);
    padding: 15px 12px;
    text-align: center;
    font-weight: 600;
    border-bottom: 2px solid var(--coffee-secondary);
}

.equipment-table td {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
    text-align: center;
}

.equipment-table tr:nth-child(even) {
    background-color: var(--coffee-gray-light);
}

.equipment-table tr:hover {
    background-color: var(--coffee-light);
    transition: var(--coffee-transition);
}

.equipment-name {
    font-weight: 600;
    color: var(--coffee-primary);
}

.equipment-description {
    color: var(--coffee-gray);
    font-size: var(--coffee-font-size-small);
}

.equipment-price {
    font-weight: 700;
    color: var(--coffee-secondary);
}

.equipment-total-row {
    background: var(--coffee-secondary) !important;
    color: var(--coffee-white);
    font-weight: 700;
}

.equipment-total-row:hover {
    background: var(--coffee-secondary) !important;
}

.equipment-total-label,
.equipment-total-value {
    font-size: var(--coffee-font-size-large);
    padding: 15px 12px !important;
}

/* أنماط قسم نقطة التعادل */
.breakeven-section {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 2px solid var(--coffee-accent);
    border-radius: var(--coffee-border-radius);
    padding: 25px;
    margin: 30px 0;
}

.breakeven-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.breakeven-card {
    background: var(--coffee-white);
    border-radius: var(--coffee-border-radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--coffee-shadow);
    transition: var(--coffee-transition);
    border: 1px solid #e0e0e0;
}

.breakeven-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--coffee-shadow-hover);
}

.breakeven-card.highlight {
    background: linear-gradient(135deg, var(--coffee-primary), var(--coffee-secondary));
    color: var(--coffee-white);
    border: none;
}

.breakeven-title {
    font-size: var(--coffee-font-size-small);
    font-weight: 600;
    margin-bottom: 10px;
    opacity: 0.8;
}

.breakeven-card.highlight .breakeven-title {
    opacity: 0.9;
}

.breakeven-value {
    font-size: var(--coffee-font-size-large);
    font-weight: 700;
    color: var(--coffee-secondary);
}

.breakeven-card.highlight .breakeven-value {
    color: var(--coffee-white);
    font-size: var(--coffee-font-size-xl);
}

.breakeven-note {
    background: var(--coffee-light);
    border-radius: var(--coffee-border-radius);
    padding: 15px;
    border-left: 4px solid var(--coffee-accent);
    margin-top: 20px;
}

.breakeven-note p {
    margin: 0;
    font-size: var(--coffee-font-size-small);
    color: var(--coffee-gray-dark);
}

/* تحسينات للأجهزة المحمولة */
@media (max-width: 768px) {
    .equipment-table {
        font-size: var(--coffee-font-size-small);
    }
    
    .equipment-table th,
    .equipment-table td {
        padding: 8px 6px;
    }
    
    .breakeven-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .breakeven-card {
        padding: 15px;
    }
    
    .equipment-details-section {
        margin-top: 20px;
    }
}

/* تحسينات إضافية للجدول */
.equipment-table th:first-child,
.equipment-table td:first-child {
    text-align: right;
    padding-right: 15px;
}

.equipment-table th:last-child,
.equipment-table td:last-child {
    text-align: left;
    padding-left: 15px;
}

/* أيقونات محسنة */
.coffee-icon-equipment::before {
    content: "🔧";
    margin-left: 8px;
}

.coffee-icon-chart::before {
    content: "📊";
    margin-left: 8px;
}