/* =============================================
   utilities.css — Worldwide Exporter
   Reusable utility classes + button system.
   variables.css ke baad load hona chahiye.
   ============================================= */

/* ── BUTTON BASE ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-family: var(--font);
    font-weight: var(--btn-fw);
    font-size: var(--btn-font-md);
    padding: var(--btn-padding-md);
    border-radius: var(--btn-radius);
    border: 1.5px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: var(--btn-transition);
    line-height: 1;
    position: relative;
    overflow: hidden;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn i { font-size: 1.1em; flex-shrink: 0; }

/* ── BUTTON VARIANTS ── */
.btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-color);
    border-color: var(--btn-primary-border);
}
.btn-primary:hover {
    background: var(--btn-primary-bg-hover);
    border-color: var(--btn-primary-bg-hover);
    color: var(--btn-primary-color);
}

/* ── Button — Secondary ── */
.btn-secondary {
    background: var(--secondary);
    color: #fff;
    border-color: var(--secondary);
}
.btn-secondary:hover {
    background: var(--secondary-hover);
    border-color: var(--secondary-hover);
    color: #fff;
}

/* ── Button — Secondary Outline ── */
.btn-secondary-outline {
    background: #fff;
    color: var(--secondary);
    border-color: var(--secondary);
}
.btn-secondary-outline:hover {
    background: var(--secondary-light);
    color: var(--secondary);
}

/* ── Button — Accent ── */
.btn-accent {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-accent:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

/* ── Button — Accent Outline ── */
.btn-accent-outline {
    background: #fff;
    color: var(--accent);
    border-color: var(--accent);
}
.btn-accent-outline:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.btn-outline {
    background: var(--btn-outline-bg);
    color: var(--btn-outline-color);
    border-color: var(--btn-outline-border);
}
.btn-outline:hover {
    background: var(--btn-outline-bg-hover);
    color: var(--btn-outline-color);
}

.btn-ghost {
    background: var(--btn-ghost-bg);
    color: var(--btn-ghost-color);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--btn-ghost-bg-hover); }

.btn-neutral {
    background: var(--btn-neutral-bg);
    color: var(--btn-neutral-color);
    border-color: var(--btn-neutral-border);
}
.btn-neutral:hover { background: var(--btn-neutral-bg-hover); color: var(--text-body); }

.btn-danger {
    background: var(--btn-danger-bg);
    color: var(--btn-danger-color);
    border-color: var(--btn-danger-bg);
}
.btn-danger:hover { background: var(--btn-danger-bg-hover); border-color: var(--btn-danger-bg-hover); }

/* ── BUTTON SIZES ── */
.btn-xs { font-size: var(--btn-font-xs); padding: var(--btn-padding-xs); border-radius: var(--btn-radius-sm); }
.btn-sm { font-size: var(--btn-font-sm); padding: var(--btn-padding-sm); border-radius: var(--btn-radius-sm); }
.btn-lg { font-size: var(--btn-font-lg); padding: var(--btn-padding-lg); }
.btn-full { width: 100%; }

/* ── BUTTON STATES ── */
.btn-loading { pointer-events: none; }
.btn-loading::after {
    content: '';
    width: 14px; height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
    margin-left: var(--space-2);
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ── BADGE / TAG ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-xs);
    font-weight: var(--fw-semi);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    line-height: 1;
    white-space: nowrap;
}
.badge-primary { background: var(--primary); color: #fff; }
.badge-outline { background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary-tint); }
.badge-neutral { background: #f3f4f6; color: var(--text-muted); }
.badge-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.badge-secondary { background: var(--secondary); color: #fff; }
.badge-secondary-outline { background: var(--secondary-light); color: var(--secondary); border: 1px solid var(--secondary-tint); }
.badge-accent { background: var(--accent); color: #fff; }
.badge-accent-outline { background: var(--accent-light); color: var(--accent); border: 1px solid var(--accent-tint); }

/* ── CHIP (dismissible) ── */
.chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary-tint);
    border-radius: var(--radius-full);
    padding: 5px 6px 5px 12px;
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
}
.chip-key { color: var(--text-muted); font-weight: var(--fw-semi); }
.chip-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px; height: 18px;
    border: none;
    background: var(--primary-alpha-12);
    color: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition-fast);
    flex-shrink: 0;
}
.chip-close:hover { background: var(--primary); color: #fff; }

.chip-secondary {
    display: inline-flex; align-items: center; gap: var(--space-2);
    background: var(--secondary-light); color: var(--secondary);
    border: 1px solid var(--secondary-tint); border-radius: var(--radius-full);
    padding: 5px 6px 5px 12px; font-size: var(--text-sm); font-weight: var(--fw-medium);
}
.chip-accent {
    display: inline-flex; align-items: center; gap: var(--space-2);
    background: var(--accent-light); color: var(--accent);
    border: 1px solid var(--accent-tint); border-radius: var(--radius-full);
    padding: 5px 6px 5px 12px; font-size: var(--text-sm); font-weight: var(--fw-medium);
}

/* ── TAG (read-only label) ── */
.tag {
    display: inline-block;
    font-size: var(--text-xs);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--tag-bg);
    color: var(--tag-color);
    font-weight: var(--fw-medium);
    white-space: nowrap;
}

/* ── CARD ── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}
.card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
    transition: var(--transition-base);
}

/* ── INPUT BASE ── */
.input {
    width: 100%;
    padding: var(--input-padding);
    font-size: var(--input-font);
    font-family: var(--font);
    color: var(--input-color);
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: var(--input-radius);
    outline: none;
    transition: var(--transition-fast);
    box-sizing: border-box;
}
.input::placeholder { color: var(--input-placeholder); font-family: var(--font); }
.input:focus {
    border-color: var(--input-border-focus);
    box-shadow: var(--input-shadow-focus);
    background: var(--input-bg-focus);
}
.input:disabled { background: var(--bg-light); color: var(--text-muted); cursor: not-allowed; }

/* ── DIVIDER ── */
.divider { height: 1px; background: var(--border-light); margin: var(--space-4) 0; }
.divider-primary { height: 2px; background: linear-gradient(90deg, var(--primary-hover), var(--primary), #A53A47); }

/* ── OVERLAY ── */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(3px);
    z-index: var(--z-overlay);
}
.overlay.open { display: block; }

/* ── SKELETON ── */
@keyframes skeleton-shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position: 600px 0; }
}
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 600px 100%;
    animation: skeleton-shimmer 1.4s infinite linear;
    border-radius: var(--radius-md);
}

/* ── DISPLAY ── */
.hidden        { display: none !important; }
.visible       { visibility: visible !important; }
.invisible     { visibility: hidden !important; }
.sr-only       { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* ── FLEX ── */
.flex          { display: flex; }
.flex-col      { display: flex; flex-direction: column; }
.flex-center   { display: flex; align-items: center; justify-content: center; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.flex-start    { display: flex; align-items: center; justify-content: flex-start; }
.flex-wrap     { flex-wrap: wrap; }
.flex-1        { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-end   { justify-content: flex-end; }
.gap-1         { gap: var(--space-1); }
.gap-2         { gap: var(--space-2); }
.gap-3         { gap: var(--space-3); }
.gap-4         { gap: var(--space-4); }

/* ── GRID ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); }

/* ── TEXT ── */
.text-primary  { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.text-accent     { color: var(--accent); }
.text-muted    { color: var(--text-muted); }
.text-subtle   { color: var(--text-subtle); }
.text-heading  { color: var(--text-heading); }
.text-center   { text-align: center; }
.text-xs       { font-size: var(--text-xs); }
.text-sm       { font-size: var(--text-sm); }
.text-base     { font-size: var(--text-base); }
.text-lg       { font-size: var(--text-lg); }
.fw-medium     { font-weight: var(--fw-medium); }
.fw-semi       { font-weight: var(--fw-semi); }
.fw-bold       { font-weight: var(--fw-bold); }
.uppercase     { text-transform: uppercase; letter-spacing: 1px; }
.truncate      { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.clamp-1       { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-2       { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3       { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-4       { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* ── SPACING ── */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.p-4  { padding: var(--space-4); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }

/* ── BORDER ── */
.border        { border: 1px solid var(--border); }
.border-top    { border-top: 1px solid var(--border-light); }
.border-bottom { border-bottom: 1px solid var(--border-light); }
.rounded-sm    { border-radius: var(--radius-sm); }
.rounded-md    { border-radius: var(--radius-md); }
.rounded-lg    { border-radius: var(--radius-lg); }
.rounded-full  { border-radius: var(--radius-full); }

/* ── FOCUS ── */
*:focus-visible { outline: 2px solid var(--primary-alpha-20); outline-offset: 2px; }

/* ── MOBILE ── */
.hide-mobile { display: block; }
.show-mobile { display: none; }
@media (max-width: 768px) {
    .hide-mobile  { display: none !important; }
    .show-mobile  { display: block !important; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}