/* ==================== إعادة تعيين عام ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    transition: direction 0.3s ease;
}

/* ==================== الحاوية الرئيسية ==================== */
.container {
    max-width: 800px;
    margin: 0 auto;
    background: #2c3e50;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* ==================== العناوين ==================== */
h1 {
    text-align: center;
    color: #f1c40f;
    margin-bottom: 10px;
    font-size: 32px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.description {
    text-align: center;
    color: #ecf0f1;
    margin-bottom: 25px;
    font-size: 14px;
}

/* ==================== شارة Premium ==================== */
.premium-badge {
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.premium-badge.free {
    background: #34495e;
    border: 2px solid #3498db;
}

.premium-badge.premium {
    background: linear-gradient(135deg, #f39c12 0%, #f1c40f 100%);
    border: none;
}

.badge-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge-icon {
    font-size: 24px;
}

.badge-text {
    color: #ecf0f1;
}

.premium-badge.premium .badge-text {
    color: #2c3e50;
    font-weight: bold;
}

.calculations-left {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 3px;
}

.upgrade-btn {
    padding: 10px 20px;
    background: #f1c40f;
    color: #2c3e50;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.upgrade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(241, 196, 15, 0.4);
}

.view-records-btn {
    padding: 10px 20px;
    background: white;
    color: #2c3e50;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.view-records-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.3);
}

/* ==================== اختيار اللغة ==================== */
.language-selector {
    margin-bottom: 25px;
    text-align: center;
}

.language-selector select {
    padding: 10px 20px;
    border: 2px solid #3498db;
    background: #34495e;
    color: #ecf0f1;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 15px;
    min-width: 200px;
    outline: none;
    transition: all 0.3s ease;
}

.language-selector select:hover {
    background: #3d566e;
}

/* ==================== اختيار المعدن ==================== */
.metal-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.metal-btn {
    flex: 1;
    padding: 15px;
    border: 3px solid #34495e;
    background: #34495e;
    color: #ecf0f1;
    border-radius: 12px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.metal-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.metal-btn.active {
    background: linear-gradient(135deg, #f39c12 0%, #f1c40f 100%);
    border-color: #f39c12;
    color: #2c3e50;
}

/* ==================== حالة API ==================== */
.api-status {
    padding: 12px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    font-weight: 500;
    font-size: 14px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.api-status.connected {
    background: #27ae60;
}

.api-status.disconnected {
    background: #e74c3c;
}

.api-status.no-key {
    background: #f39c12;
}

/* ==================== الأقسام ==================== */
.section {
    background: #34495e;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

label {
    display: block;
    color: #ecf0f1;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
}

input {
    width: 100%;
    padding: 12px;
    border: 3px solid #3498db;
    border-radius: 8px;
    font-size: 20px;
    background: #ecf0f1;
    color: #1a252f;
    font-weight: 800;
    outline: none;
    transition: all 0.3s ease;
}

input:focus {
    border-color: #2980b9;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.3);
}

input::placeholder {
    color: #bdc3c7 !important;
    opacity: 0.5 !important;
    font-weight: 400 !important;
}

/* ==================== السبائك ==================== */
.ingot-inputs {
    background: #34495e;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 3px solid #f1c40f;
    position: relative;
}

.ingot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.ingot-title {
    font-weight: bold;
    color: #f1c40f;
    font-size: 18px;
}

.remove-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.remove-btn:hover {
    background: #c0392b;
    transform: rotate(90deg);
}

.ingot-fields {
    display: flex;
    gap: 15px;
}

.ingot-field {
    flex: 1;
}

.ingot-inputs input {
    border-color: #27ae60;
}

/* ==================== زر إضافة سبيكة ==================== */
.add-ingot-btn {
    width: 100%;
    padding: 15px;
    border: 2px dashed #3498db;
    background: transparent;
    color: #3498db;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
    margin-bottom: 25px;
}

.add-ingot-btn:hover {
    background: rgba(52, 152, 219, 0.1);
    border-style: solid;
}

/* ==================== أزرار التحكم ==================== */
.button-group {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.calculate-btn,
.reset-btn {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.calculate-btn {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: white;
}

.reset-btn {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.calculate-btn:hover,
.reset-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

/* ==================== النتائج ==================== */
#results {
    background: #34495e;
    padding: 25px;
    border-radius: 12px;
    margin-top: 25px;
    border: 3px solid #27ae60;
}

#results.error {
    border-color: #e74c3c;
}

.results-header {
    font-size: 22px;
    font-weight: bold;
    color: #f1c40f;
    margin-bottom: 20px;
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #27ae60;
}

.result-item {
    padding: 15px;
    margin-bottom: 12px;
    background: #2c3e50;
    border-radius: 8px;
    color: #ecf0f1;
    font-size: 16px;
}

.result-item .highlight {
    color: #f1c40f;
    font-weight: bold;
    font-size: 20px;
}

.result-success {
    border-left: 5px solid #27ae60;
    background: rgba(39, 174, 96, 0.1);
}

.result-info {
    border-left: 5px solid #3498db;
    background: rgba(52, 152, 219, 0.1);
}

.result-error {
    border-left: 5px solid #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.save-record-btn {
    width: 100%;
    margin-top: 15px;
    padding: 12px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 15px;
}

.save-record-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

/* ==================== النوافذ المنبثقة ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #2c3e50;
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #ecf0f1;
    font-size: 28px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.modal-header {
    text-align: center;
    margin-bottom: 25px;
}

.modal-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.modal-title {
    font-size: 24px;
    font-weight: bold;
    color: #f1c40f;
    margin-bottom: 10px;
}

.modal-description {
    color: #ecf0f1;
    font-size: 14px;
    opacity: 0.9;
}

/* ==================== قائمة المميزات ==================== */
.features-list {
    margin-bottom: 25px;
}

.feature-item {
    background: #34495e;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    color: #ecf0f1;
    font-size: 15px;
}

/* ==================== خيارات التسعير ==================== */
.pricing-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pricing-btn {
    padding: 15px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.pricing-btn.monthly {
    background: linear-gradient(135deg, #f39c12 0%, #f1c40f 100%);
    color: #2c3e50;
}

.pricing-btn.yearly {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: white;
}

.pricing-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* ==================== السجلات المحفوظة ==================== */
.records-list {
    max-height: 400px;
    overflow-y: auto;
}

.record-item {
    background: #34495e;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.record-item:hover {
    background: #3d566e;
}

.record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.record-date {
    color: #95a5a6;
    font-size: 12px;
}

.delete-record-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.delete-record-btn:hover {
    background: #c0392b;
}

.record-details {
    color: #ecf0f1;
    font-size: 14px;
    line-height: 1.8;
}

.record-details div {
    padding: 3px 0;
}

.no-records {
    text-align: center;
    color: #95a5a6;
    padding: 40px 20px;
    font-size: 16px;
}

/* ==================== مخفي ==================== */
.hidden {
    display: none !important;
}

/* ==================== تصميم متجاوب ==================== */
@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 24px;
    }

    .description {
        font-size: 13px;
    }

    .button-group {
        flex-direction: column;
    }

    .metal-selector {
        flex-direction: column;
    }

    .ingot-fields {
        flex-direction: column;
    }

    .premium-badge {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .modal-content {
        padding: 20px;
    }

    .modal-title {
        font-size: 20px;
    }

    input {
        font-size: 18px;
    }
}

/* ==================== Scrollbar تخصيص ==================== */
.records-list::-webkit-scrollbar {
    width: 8px;
}

.records-list::-webkit-scrollbar-track {
    background: #2c3e50;
    border-radius: 10px;
}

.records-list::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 10px;
}

.records-list::-webkit-scrollbar-thumb:hover {
    background: #2980b9;
}