/* global-theme.css */
:root {
    /* Emerald Green Monochromatic Theme */
    --primary-main: #059669; /* Base Primary */
    --primary-light: #10b981;
    --primary-dark: #047857;

    /* Bootstrap Overrides */
    --bs-primary: var(--primary-main);
    --bs-primary-rgb: 5, 150, 105;
    --bs-body-font-size: clamp(12px, calc(12px + 0.25vw), 14px);
    --bs-font-sans-serif:
        "IranYekan", system-ui, -apple-system, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;

    --bs-body-bg: #f8fafc;
    --bs-border-radius: 12px;
    --bs-border-radius-sm: 8px;
    --bs-border-radius-lg: 16px;
    --bs-box-shadow-sm:
        0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

body {
    background-color: var(--bs-body-bg);
}

/* Typography Scaling - Responsive with clamp() */
h1,
.h1 {
    font-size: clamp(1.2rem, calc(1.3rem + 0.5vw), 1.8rem) !important;
    font-weight: bold;
}
h2,
.h2 {
    font-size: clamp(1.1rem, calc(1.15rem + 0.4vw), 1.5rem) !important;
    font-weight: bold;
}
h3,
.h3 {
    font-size: clamp(1rem, calc(1.05rem + 0.3vw), 1.3rem) !important;
    font-weight: 600;
}
h4,
.h4 {
    font-size: clamp(0.95rem, calc(1rem + 0.2vw), 1.15rem) !important;
    font-weight: 600;
}
h5,
.h5 {
    font-size: clamp(0.85rem, calc(0.9rem + 0.15vw), 1rem) !important;
}
h6,
.h6 {
    font-size: clamp(0.8rem, calc(0.85rem + 0.1vw), 0.9rem) !important;
}

.small,
small {
    font-size: clamp(10px, calc(11px + 0.15vw), 12px) !important;
}

/* Base UI Elements */
.btn {
    border-radius: var(--bs-border-radius);
    padding: clamp(0.3rem, calc(0.35rem + 0.1vw), 0.5rem)
        clamp(0.6rem, calc(0.7rem + 0.3vw), 1rem);
    font-size: clamp(11px, calc(12px + 0.2vw), 14px);
    font-weight: 500;
    transition: all 0.25s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Small buttons - more compact */
.btn-sm {
    padding: clamp(0.2rem, calc(0.25rem + 0.1vw), 0.4rem)
        clamp(0.4rem, calc(0.5rem + 0.2vw), 0.7rem);
    font-size: clamp(10px, calc(11px + 0.15vw), 12px);
}

/* Mobile overrides */
@media (max-width: 768px) {
    .btn {
        padding: 0.3rem 0.6rem;
        font-size: 11px;
    }
    .btn-sm {
        padding: 0.2rem 0.4rem;
        font-size: 10px;
    }
}

.btn-primary {
    background-color: var(--primary-main);
    border-color: var(--primary-main);
}
.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--bs-box-shadow-sm);
}

.btn-outline-primary {
    color: var(--primary-main);
    border-color: var(--primary-main);
}
.btn-outline-primary:hover {
    background-color: var(--primary-main);
    border-color: var(--primary-main);
}

/* Button focus - remove blue Bootstrap outline */
.btn:focus,
.btn-primary:focus,
.btn-outline-primary:focus,
.btn-secondary:focus,
.btn-outline-secondary:focus,
.btn-success:focus,
.btn-danger:focus {
    box-shadow: 0 0 0 0.2rem rgba(156, 163, 175, 0.25) !important;
}

/* Card Improvements */
.card {
    border: none !important;
    border-radius: var(--bs-border-radius-lg);
    box-shadow:
        0 4px 6px -1px rgb(0 0 0 / 0.05),
        0 2px 4px -2px rgb(0 0 0 / 0.05);
    transition: box-shadow 0.2s ease;
}
.card:hover {
    box-shadow: var(--bs-box-shadow-sm);
}

/* Forms - Responsive sizing with calc() */
.form-control,
.form-select {
    border-radius: var(--bs-border-radius-sm);
    border: 1px solid #dee2e6;
    /* Responsive: clamp(min, preferred, max) for better control */
    font-size: clamp(11px, calc(12px + 0.25vw), 14px);
    padding: clamp(0.35rem, calc(0.4rem + 0.15vw), 0.6rem)
        clamp(0.6rem, calc(0.7rem + 0.3vw), 1rem);
    min-height: clamp(32px, calc(34px + 0.5vw), 42px);
}

/* Small form controls - more compact */
.form-control-sm,
.form-select-sm {
    font-size: clamp(10px, calc(11px + 0.2vw), 12px);
    padding: clamp(0.25rem, calc(0.3rem + 0.1vw), 0.45rem)
        clamp(0.5rem, calc(0.6rem + 0.2vw), 0.8rem);
    min-height: clamp(28px, calc(30px + 0.4vw), 36px);
}

/* Placeholder styling - smaller and lighter */
.form-control::placeholder,
.form-control-sm::placeholder {
    font-size: clamp(9px, calc(10px + 0.2vw), 12px);
    color: #adb5bd;
    opacity: 0.9;
}

.form-control:focus,
.form-select:focus {
    border-color: #9ca3af;
    box-shadow: 0 0 0 0.2rem rgba(156, 163, 175, 0.25);
}

/* Global focus override - remove Bootstrap blue, use gray instead */
*:focus {
    outline: none;
}

*:focus-visible {
    outline: 2px solid #9ca3af;
    outline-offset: 2px;
}

/* RTL Fix for form-select - arrow should be on left with proper padding */
/* Using same calc() values as form-control for consistent sizing */
.form-select {
    background-position: left 0.75rem center !important;
    /* Keep same vertical padding as form-control but adjust horizontal for arrow */
    padding-top: clamp(0.35rem, calc(0.4rem + 0.15vw), 0.6rem) !important;
    padding-bottom: clamp(0.35rem, calc(0.4rem + 0.15vw), 0.6rem) !important;
    padding-left: clamp(2rem, calc(2.2rem + 0.3vw), 2.5rem) !important;
    padding-right: clamp(0.6rem, calc(0.7rem + 0.3vw), 1rem) !important;
    min-height: clamp(32px, calc(34px + 0.5vw), 42px);
}

/* Smaller form-select needs same RTL fix with calc() sizing */
.form-select-sm {
    background-position: left 0.6rem center !important;
    padding-top: clamp(0.25rem, calc(0.3rem + 0.1vw), 0.45rem) !important;
    padding-bottom: clamp(0.25rem, calc(0.3rem + 0.1vw), 0.45rem) !important;
    padding-left: clamp(1.75rem, calc(1.9rem + 0.2vw), 2.2rem) !important;
    padding-right: clamp(0.5rem, calc(0.6rem + 0.2vw), 0.8rem) !important;
    min-height: clamp(28px, calc(30px + 0.4vw), 36px);
}

/* Responsive tables and cards */
@media (max-width: 768px) {
    .form-control {
        font-size: 11px;
        padding: 0.3rem 0.5rem;
        min-height: 30px;
    }
    .form-control-sm {
        font-size: 11px;
        padding: 0.25rem 0.4rem;
        min-height: 28px;
    }
    .form-control::placeholder,
    .form-control-sm::placeholder {
        font-size: 10px;
    }
    /* Keep RTL padding for form-select on mobile - match form-control sizes */
    .form-select {
        font-size: 11px;
        padding-top: 0.3rem !important;
        padding-bottom: 0.3rem !important;
        padding-left: 1.75rem !important;
        padding-right: 0.5rem !important;
        min-height: 30px;
    }
    .form-select-sm {
        font-size: 11px;
        padding-top: 0.25rem !important;
        padding-bottom: 0.25rem !important;
        padding-left: 1.5rem !important;
        padding-right: 0.4rem !important;
        min-height: 28px;
    }
}

/* Soft utilities */
.text-primary {
    color: var(--primary-main) !important;
}
.bg-primary {
    background-color: var(--primary-main) !important;
}
.bg-primary-soft {
    background-color: rgba(16, 185, 129, 0.1) !important;
    color: var(--primary-dark) !important;
}
