/* ============================================================
   INNOVER — COMPONENTS CSS
   Botões, Modais, Cards, Tabelas, Formulários, Badges, Toast
   ============================================================ */

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
    position: relative;
    overflow: hidden;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn i { font-size: 16px; }

.btn-primary {
    background: var(--gold-gradient);
    color: var(--text-on-gold);
    box-shadow: var(--shadow-gold);
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(196,154,6,0.40); }

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--gold-primary); }

.btn-outline {
    background: transparent;
    color: var(--gold-primary);
    border: 1.5px solid var(--gold-primary);
}
.btn-outline:hover { background: var(--gold-soft); }

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-success:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-md);
}

.btn-sm { padding: 6px 14px; font-size: var(--font-size-xs); }
.btn-lg { padding: 14px 28px; font-size: var(--font-size-md); }

.btn-group { display: flex; gap: 8px; }

/* Action buttons row */
.action-btns { display: flex; gap: 6px; align-items: center; }
.action-btns .btn-icon { width: 34px; height: 34px; border-radius: var(--radius-sm); }

/* ---- CARDS ---- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    overflow: hidden;
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}
.card-header h3 { font-size: var(--font-size-lg); font-weight: 700; }
.card-body { padding: var(--space-lg); }
.card-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-sm);
}

/* ---- MODALS (Blur Apple Style) ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-modal-overlay);
    backdrop-filter: var(--blur-modal);
    -webkit-backdrop-filter: var(--blur-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal-overlay);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    padding: var(--space-lg);
}
.modal-overlay.active { opacity: 1 !important; visibility: visible !important; pointer-events: auto !important; }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }

.modal-lg { max-width: 760px; }
.modal-xl { max-width: 960px; }

.modal-header {
    padding: var(--space-lg) var(--space-lg) var(--space-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h2 { font-size: var(--font-size-xl); font-weight: 700; }
.modal-close {
    width: 32px; height: 32px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    font-size: 18px;
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }
.modal-body { padding: 0 var(--space-lg) var(--space-lg); }
.modal-footer {
    padding: var(--space-md) var(--space-lg) var(--space-lg);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

/* ---- FORMS ---- */
.form-group { margin-bottom: var(--space-lg); }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-md); }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); }

.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1.5px solid var(--border-input);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    outline: none;
}
.form-control:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--gold-soft); background: var(--bg-card); }
.form-control::placeholder { color: var(--text-tertiary); }

select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236E6E73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

textarea.form-control { resize: vertical; min-height: 100px; }

.form-text { font-size: var(--font-size-xs); color: var(--text-tertiary); margin-top: 4px; }

/* ---- TABLES ---- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.table thead th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    background: var(--bg-table-header);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.table tbody tr { transition: var(--transition-fast); }
.table tbody tr:hover { background: var(--bg-table-hover); }
.table tbody tr:nth-child(even) { background: var(--bg-table-stripe); }
.table tbody tr:nth-child(even):hover { background: var(--bg-table-hover); }
.table tbody tr:last-child td { border-bottom: none; }

/* Table search/filter bar */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    min-width: 280px;
}
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-tertiary); font-size: 16px; }
.search-box input { padding-left: 38px; }

/* ---- BADGES ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    white-space: nowrap;
}
.badge-gold { background: var(--bg-badge); color: var(--gold-primary); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-secondary { background: var(--bg-input); color: var(--text-secondary); }

/* ---- TOAST NOTIFICATIONS ---- */
.toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    min-width: 320px;
    max-width: 480px;
    animation: slideInRight 0.4s ease-out;
    transition: var(--transition);
}
.toast.hide { opacity: 0; transform: translateX(100%); }
.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-info { border-left: 4px solid var(--info); }

.toast-icon { font-size: 20px; flex-shrink: 0; }
.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }

.toast-content { flex: 1; }
.toast-title { font-weight: 600; font-size: var(--font-size-sm); color: var(--text-primary); }
.toast-message { font-size: var(--font-size-xs); color: var(--text-secondary); margin-top: 2px; }

/* ---- AVATAR ---- */
.avatar {
    width: 40px; height: 40px;
    border-radius: var(--radius-full);
    background: var(--gold-gradient);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-size-sm);
    flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: var(--font-size-xs); }
.avatar-lg { width: 56px; height: 56px; font-size: var(--font-size-lg); }

/* ---- TABS ---- */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    gap: 4px;
    margin-bottom: var(--space-lg);
    overflow-x: auto;
}

.tab {
    padding: 10px 20px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary);
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition-fast);
    white-space: nowrap;
    font-family: var(--font-family);
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--gold-primary); border-bottom-color: var(--gold-primary); font-weight: 600; }

/* ---- DROPDOWN ---- */
.dropdown { position: relative; display: inline-block; }

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--bg-dropdown);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: var(--transition-fast);
    overflow: hidden;
}
.dropdown.active .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-family);
}
.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border-color); margin: 4px 0; }

/* ---- PAGINATION ---- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: var(--space-lg) 0;
}

.page-btn {
    width: 36px; height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: var(--font-family);
}
.page-btn:hover { border-color: var(--gold-primary); color: var(--gold-primary); }
.page-btn.active { background: var(--gold-gradient); color: var(--white); border-color: transparent; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- SWITCH TOGGLE ---- */
.switch {
    position: relative;
    width: 44px;
    height: 26px;
    display: inline-block;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-input);
    border: 1.5px solid var(--border-input);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition);
}
.switch-slider::before {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    left: 2px; top: 50%;
    transform: translateY(-50%);
    background: var(--white);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.switch input:checked + .switch-slider { background: var(--gold-primary); border-color: var(--gold-primary); }
.switch input:checked + .switch-slider::before { left: calc(100% - 22px); }

/* ---- ALERT FLASH ---- */
.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    font-size: var(--font-size-sm);
    font-weight: 500;
    animation: fadeInDown 0.3s ease-out;
}
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(52,199,89,0.2); }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(255,59,48,0.2); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(255,149,0,0.2); }
.alert-info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(0,122,255,0.2); }

/* ---- IMAGE UPLOAD PREVIEW ---- */
.img-upload-area {
    width: 120px; height: 120px;
    border: 2px dashed var(--border-input);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-tertiary);
    font-size: var(--font-size-xs);
    text-align: center;
    gap: 4px;
    overflow: hidden;
    position: relative;
}
.img-upload-area:hover { border-color: var(--gold-primary); color: var(--gold-primary); background: var(--gold-soft); }
.img-upload-area img { width: 100%; height: 100%; object-fit: cover; }
.img-upload-area input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---- INSIGHT/OPPORTUNITY CARD ---- */
.insight-card {
    padding: var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    transition: var(--transition);
}
.insight-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.insight-card .insight-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}
.insight-card .insight-icon.bulb { background: var(--warning-bg); color: var(--warning); }
.insight-card .insight-icon.alert { background: var(--danger-bg); color: var(--danger); }
.insight-card .insight-icon.trend { background: var(--success-bg); color: var(--success); }
.insight-card .insight-icon.stock { background: var(--info-bg); color: var(--info); }
.insight-card .insight-text h4 { font-size: var(--font-size-sm); font-weight: 600; margin-bottom: 4px; }
.insight-card .insight-text p { font-size: var(--font-size-xs); color: var(--text-secondary); margin: 0; line-height: 1.5; }
.insight-card .insight-action {
    margin-top: 8px;
    font-size: var(--font-size-xs);
    color: var(--gold-primary);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
