:root {
    --primary-red: #dc3545;
    --primary-red-dark: #b71c1c;
    --primary-yellow: #ffc107;
    --primary-yellow-dark: #e0a800;
    --light-bg: #fff8dc;
    --light-bg-alt: #ffeaa7;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.gcm-container {
    font-family: var(--font-family);
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    direction: rtl;
    text-align: right;
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(220, 53, 69, 0.1);
}

.gcm-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-red), var(--primary-yellow));
    border-radius: 15px;
    box-shadow: 0 3px 10px rgba(220, 53, 69, 0.2);
}

.gcm-title {
    color: #fff;
    font-size: 1.8rem;
    margin: 0 0 10px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.gcm-subtitle {
    color: #fff;
    font-size: 1rem;
    margin: 0;
    opacity: 0.9;
}

.gcm-calculator-wrapper {
    background: linear-gradient(135deg, #fff5f5, #fffbf0);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(207, 137, 12, 0.25);
}

.gcm-input-group {
    margin-bottom: 30px;
}

/* Unified style for headings like اختر الوحدة: and أدخل الوزن */
.gcm-unit-label,
.gcm-weight-label {
    display: block;
    text-align: center;
    color: var(--primary-red);
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 8px;
}

/* Carat Buttons */
.gcm-carat-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.gcm-carat-btn {
    background: linear-gradient(135deg, #fff, var(--light-bg-alt));
    border: 2px solid var(--primary-red);
    color: var(--primary-red);
    padding: 12px 18px;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.gcm-carat-btn:hover,
.gcm-carat-btn:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
    outline: none;
}

.gcm-carat-btn.active {
    background: linear-gradient(135deg, var(--primary-red), var(--primary-yellow));
    color: #fff;
    border-color: var(--primary-red-dark);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

/* FIRST: Unit Selector */
.gcm-unit-selector {
    margin-bottom: 10px;
    text-align: center;
}

.gcm-unit-select-standalone {
    padding: 8px 18px; /* Slightly smaller padding */
    background: linear-gradient(135deg, var(--primary-red), var(--primary-yellow));
    color: #fff;
    border: none;
    border-radius: 25px;
    font-size: 0.95rem; /* Smaller font size so text fits */
    font-weight: bold;
    cursor: pointer;
    outline: none;
    min-width: 120px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.2);
    padding-top: 6px; /* Shift text further up */
}

.gcm-unit-select-standalone:hover {
    background: linear-gradient(135deg, var(--primary-red-dark), var(--primary-yellow-dark));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.3);
}

/* SECOND: Weight Input */
.gcm-weight-input-container {
    margin-top: 10px; /* Added space after heading */
    margin-bottom: 15px;
    text-align: center;
}

.gcm-weight-input-standalone {
    width: 100%;
    padding: 18px 20px;
    border: 3px solid var(--primary-red);
    border-radius: 15px;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    outline: none;
    background: white;
    color: var(--primary-red-dark);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.15);
    transition: all 0.3s ease;
}

.gcm-weight-input-standalone::placeholder {
    color: #999;
    font-weight: 400;
}

.gcm-weight-input-standalone:focus {
    border-color: var(--primary-yellow);
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.3);
    transform: translateY(-1px);
    background: rgba(255, 193, 7, 0.05);
}

/* Help Text */
.gcm-help-text {
    font-size: 0.8rem;
    color: #666;
    text-align: center;
    font-style: italic;
    padding: 8px 15px;
    background: rgba(255, 193, 7, 0.1);
    border-radius: 8px;
    border: none;
}

.gcm-results {
    margin-top: 35px;
}

.gcm-result-card {
    background: linear-gradient(135deg, var(--primary-red-dark), var(--primary-yellow-dark));
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 6px 20px rgba(183, 28, 28, 0.3);
}

.gcm-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.gcm-result-title {
    color: #fff;
    font-size: 1.3rem;
    margin: 0;
    font-weight: bold;
}

.gcm-selected-carat {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: bold;
}

.gcm-result-main {
    margin-bottom: 15px;
}

.gcm-result-currency,
.gcm-result-amount {
    color: #fff;
    font-size: 2.5rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.gcm-result-secondary {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.2rem;
    font-weight: 600;
}

.gcm-breakdown {
    background: rgba(255, 193, 7, 0.15);
    border: 2px solid var(--primary-yellow);
    border-radius: 12px;
    padding: 20px;
}

.gcm-breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 1.05rem;
}

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

.gcm-breakdown-label {
    color: var(--primary-red);
    font-weight: bold;
}

.gcm-breakdown-value {
    color: var(--primary-red-dark);
    font-weight: 600;
}

.gcm-disclaimer {
    margin-top: 20px;
    text-align: center;
}

.gcm-disclaimer small {
    color: #666;
    font-size: 0.85rem;
}

.gcm-no-data {
    text-align: center;
    padding: 40px;
    color: var(--primary-red);
    font-size: 1.2rem;
    background: linear-gradient(135deg, #fff5f5, var(--light-bg-alt));
    border-radius: 15px;
    border: 3px dashed var(--primary-red);
}

@media (max-width: 768px) {
    .gcm-container {
        padding: 15px;
    }
    
    .gcm-carat-buttons {
        justify-content: center;
    }
    
    .gcm-carat-btn {
        font-size: 0.85rem;
        padding: 10px 14px;
    }
    
    .gcm-weight-input-standalone {
        font-size: 1.1rem;
        padding: 15px 18px;
    }
    
    .gcm-result-currency,
    .gcm-result-amount {
        font-size: 2rem;
    }
}

@keyframes highlight-gold {
    0% { background-color: rgba(255, 193, 7, 0.4); }
    100% { background-color: transparent; }
}

.gcm-result-amount.updated,
.gcm-result-secondary.updated {
    animation: highlight-gold 1s ease;
}