/* ── Variables ───────────────────────────────────────── */
:root {
    --accent-red: #c44536;
    --gradient-red: linear-gradient(135deg, #c44536, #d95f4e);
    --dark-bg: #0a0a0a;
    --dark-card: #111111;
    --dark-card-border: rgba(255, 255, 255, 0.07);
    --text-secondary: #a0a0a0;
    --text-muted: #5a5a5a;
}

/* ── Base ─────────────────────────────────────────────── */
body {
    font-family: 'Raleway', sans-serif;
    background: var(--dark-bg);
    min-height: 100vh;
    padding: 80px 20px 60px;
}

/* ── Background decorations ──────────────────────────── */
.page-bg-glow {
    position: fixed;
    top: 0;
    right: 0;
    width: 65vw;
    height: 65vh;
    background: radial-gradient(ellipse at 75% 15%, rgba(196, 69, 54, 0.08) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.page-bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
    -webkit-mask-image: radial-gradient(ellipse at center, black 5%, transparent 75%);
    mask-image: radial-gradient(ellipse at center, black 5%, transparent 75%);
}

/* ── Page container ──────────────────────────────────── */
.stock-container {
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* ── Header ──────────────────────────────────────────── */
.stock-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.stock-eyebrow {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--accent-red);
    background: rgba(196, 69, 54, 0.1);
    border: 1px solid rgba(196, 69, 54, 0.25);
    border-radius: 20px;
    padding: 0.35rem 1rem;
    margin-bottom: 1rem;
}

.stock-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.5rem;
    line-height: 1.15;
}

.gradient-text {
    background: var(--gradient-red);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stock-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin: 0;
}

/* ── Toolbar ─────────────────────────────────────────── */
.stock-toolbar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.stock-search-wrap {
    flex: 1;
    min-width: 200px;
    position: relative;
    display: flex;
    align-items: center;
}

.stock-search-wrap i {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.stock-search-wrap input {
    width: 100%;
    background: var(--dark-card);
    border: 1px solid var(--dark-card-border);
    border-radius: 10px;
    color: #fff;
    padding: 0.65rem 1rem 0.65rem 2.5rem;
    font-family: 'Raleway', sans-serif;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.stock-search-wrap input:focus {
    outline: none;
    border-color: rgba(196, 69, 54, 0.5);
}

.stock-search-wrap input::placeholder { color: var(--text-muted); }

.btn-new-stock {
    background: var(--gradient-red);
    border: none;
    border-radius: 10px;
    padding: 0.65rem 1.25rem;
    font-family: 'Raleway', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}

.btn-new-stock:hover { opacity: 0.9; }

/* ── States ──────────────────────────────────────────── */
.loading-state,
.empty-state,
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    gap: 1rem;
    color: var(--text-secondary);
}

.loading-state .spinner-border {
    color: var(--accent-red);
    width: 2.5rem;
    height: 2.5rem;
}

.state-icon-wrap {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.loading-state h3,
.empty-state h3,
.error-state h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

/* ── Table ───────────────────────────────────────────── */
.stock-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.4rem;
}

.stock-table thead th {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--dark-card-border);
}

.stock-row {
    background: var(--dark-card);
    border-radius: 10px;
    transition: background 0.15s;
}

.stock-row:hover { background: #1a1a1a; }

.stock-row td {
    padding: 0.75rem;
    vertical-align: middle;
    font-size: 0.9rem;
    color: #d0d0d0;
}

.stock-row td:first-child { border-radius: 10px 0 0 10px; }
.stock-row td:last-child  { border-radius: 0 10px 10px 0; }

.stock-cell-name {
    font-weight: 600;
    color: #fff;
}

.stock-notes-preview {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

/* ── Category chip ───────────────────────────────────── */
.stock-category-chip {
    display: inline-block;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--dark-card-border);
    border-radius: 20px;
    font-size: 0.75rem;
    padding: 0.15rem 0.65rem;
    color: var(--text-secondary);
}

.stock-no-value { color: var(--text-muted); }

/* ── Quantity adjust ─────────────────────────────────── */
.stock-qty-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.stock-adj-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid var(--dark-card-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.stock-adj-btn:hover:not(:disabled) {
    background: rgba(196, 69, 54, 0.15);
    border-color: rgba(196, 69, 54, 0.4);
    color: #e87060;
}

.stock-adj-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.stock-qty-value {
    min-width: 2rem;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
}

/* ── Row actions ─────────────────────────────────────── */
.stock-actions {
    display: flex;
    gap: 0.4rem;
    justify-content: flex-end;
}

.stock-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.stock-btn-edit:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.stock-btn-delete:hover {
    background: rgba(196, 69, 54, 0.2);
    color: #e87060;
}

/* ── No results row ──────────────────────────────────── */
.stock-no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.stock-no-results i { font-size: 1.5rem; display: block; margin-bottom: 0.5rem; }

/* ── Modal styles (shared via auth.css, extras here) ── */
.crm-modal  { background: #111; border: 1px solid rgba(255,255,255,0.07); border-radius: 16px; }
.crm-modal-header { border-bottom: 1px solid rgba(255,255,255,0.07); padding: 1.25rem 1.5rem; }
.crm-modal-header .modal-title { font-weight: 700; font-size: 1.05rem; color: #fff; }
.crm-modal-body  { padding: 1.5rem; }
.crm-modal-footer { border-top: 1px solid rgba(255,255,255,0.07); padding: 1rem 1.5rem; gap: 0.75rem; }

.crm-form-section { margin-bottom: 1.5rem; }
.crm-form-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.crm-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.crm-input {
    width: 100%;
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: #fff;
    padding: 0.6rem 0.9rem;
    font-family: 'Raleway', sans-serif;
    font-size: 0.88rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.crm-input:focus {
    outline: none;
    border-color: rgba(196, 69, 54, 0.5);
    box-shadow: 0 0 0 3px rgba(196, 69, 54, 0.08);
}

.crm-input::placeholder { color: #444; }

.crm-input.is-invalid { border-color: rgba(196, 69, 54, 0.7); }

.crm-textarea { resize: vertical; min-height: 80px; }

.crm-field-error {
    font-size: 0.78rem;
    color: #e87060;
    margin-top: 0.3rem;
    min-height: 1rem;
}

.btn-outline-crm {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-secondary);
    border-radius: 10px;
    padding: 0.65rem 1.25rem;
    font-family: 'Raleway', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
}

.btn-outline-crm:hover { background: rgba(255,255,255,0.05); color: #fff; }

/* ── Primary button (gradient rojo) ─────────────────── */
.btn-primary {
    background: var(--gradient-red) !important;
    border: none !important;
    color: white !important;
    font-weight: 600;
    border-radius: 50px;
    padding: 0.65rem 1.5rem;
    box-shadow: 0 4px 16px rgba(196, 69, 54, 0.3);
    transition: all 0.25s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(196, 69, 54, 0.45);
    opacity: 0.95;
}

/* ── Auth Loader ─────────────────────────────────────── */
#authLoader {
    position: fixed;
    inset: 0;
    background: var(--dark-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s;
}

#authLoader.hidden {
    opacity: 0;
    pointer-events: none;
}

.auth-loader-spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid rgba(196, 69, 54, 0.2);
    border-top-color: var(--accent-red);
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

.auth-loader-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
