/* ============================================
   ERP SYSTEM - UI COMPONENTS STYLES
   ============================================ */

/* ==================== TOAST ==================== */

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.ui-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 10px rgba(0, 0, 0, 0.1);
    min-width: 300px;
    max-width: 450px;
    pointer-events: auto;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ui-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.ui-toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.ui-toast-icon svg {
    width: 100%;
    height: 100%;
}

.ui-toast-message {
    flex: 1;
    font-size: 0.9rem;
    color: #1e293b;
    line-height: 1.4;
}

.ui-toast-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.ui-toast-close:hover {
    color: #64748b;
}

/* Toast Types */
.ui-toast-success {
    border-left: 4px solid #10b981;
}
.ui-toast-success .ui-toast-icon {
    color: #10b981;
}

.ui-toast-error {
    border-left: 4px solid #ef4444;
}
.ui-toast-error .ui-toast-icon {
    color: #ef4444;
}

.ui-toast-warning {
    border-left: 4px solid #f59e0b;
}
.ui-toast-warning .ui-toast-icon {
    color: #f59e0b;
}

.ui-toast-info {
    border-left: 4px solid #3b82f6;
}
.ui-toast-info .ui-toast-icon {
    color: #3b82f6;
}

/* ==================== CONFIRM MODAL ==================== */

.ui-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ui-confirm-overlay.show {
    opacity: 1;
}

.ui-confirm-box {
    background: white;
    border-radius: 20px;
    padding: 32px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ui-confirm-overlay.show .ui-confirm-box {
    transform: scale(1) translateY(0);
}

.ui-confirm-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ui-confirm-icon svg {
    width: 32px;
    height: 32px;
}

/* Icon colors by type */
.ui-confirm-warning .ui-confirm-icon {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #d97706;
}

.ui-confirm-danger .ui-confirm-icon {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #dc2626;
}

.ui-confirm-info .ui-confirm-icon {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #2563eb;
}

.ui-confirm-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 12px;
}

.ui-confirm-message {
    font-size: 0.95rem;
    color: #64748b;
    margin: 0 0 28px;
    line-height: 1.6;
}

.ui-confirm-message strong {
    color: #1e293b;
}

.ui-confirm-message small {
    display: block;
    margin-top: 8px;
    font-size: 0.85rem;
    color: #94a3b8;
}

.ui-confirm-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ==================== CONFIRM TYPED ==================== */

.ui-confirm-typed {
    margin: -10px 0 18px;
    text-align: left;
}

.ui-confirm-hint {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 10px;
}

.ui-confirm-input {
    width: 100%;
    height: 44px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 0 14px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ui-confirm-input:focus {
    border-color: rgba(59, 130, 246, 0.55);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.ui-btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
}

.ui-btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    min-width: 120px;
}

.ui-btn-cancel {
    background: #f1f5f9;
    color: #64748b;
}

.ui-btn-cancel:hover {
    background: #e2e8f0;
    color: #475569;
}

.ui-btn-confirm {
    color: white;
}

.ui-btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.ui-btn-warning:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.ui-btn-danger {
    background: transparent;
    background-image: linear-gradient(to right, hsl(0 84.2% 60.2%), hsl(0 84.2% 60.2% / 0.6), hsl(0 84.2% 60.2%));
    background-size: 200% auto;
    background-position: 0% center;
}

.ui-btn-danger:hover {
    background-position: 99% center;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.ui-btn-info {
    background: transparent;
    background-image: linear-gradient(to right, hsl(221 83% 53%), hsl(221 83% 53% / 0.7), hsl(221 83% 53%));
    background-size: 200% auto;
    background-position: 0% center;
}

.ui-btn-info:hover {
    background-position: 99% center;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px hsl(221 83% 53% / 0.4);
}

.ui-btn-info:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px hsl(221 83% 53% / 0.3);
}

.ui-btn-info:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px hsl(221 83% 53% / 0.25);
}

/* ==================== CALENDAR / DATEPICKER ==================== */

.ui-datepicker-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

/* Design igual ao animated select de clientes */
.ui-datepicker-input {
    width: 100%;
    padding: 8px 12px;
    padding-right: 40px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--foreground, #1e293b);
    background: var(--background, #ffffff);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ui-datepicker-input:hover {
    border-color: var(--ring, #94a3b8);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.ui-datepicker-input:focus {
    outline: none;
    border-color: var(--ring, #1f2937);
    box-shadow: 0 0 0 2px var(--background, #fff), 0 0 0 3px var(--ring, #1f2937);
}

.ui-datepicker-input::placeholder {
    color: var(--muted-foreground, #94a3b8);
    font-weight: 400;
}

.ui-datepicker-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--muted-foreground, #64748b);
    pointer-events: none;
    transition: color 0.2s ease;
}

.ui-datepicker-wrapper:hover .ui-datepicker-icon {
    color: var(--foreground, #1e293b);
}

/* Calendar Popover */
.ui-calendar {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 9999;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12), 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 16px;
    min-width: 280px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
}

.ui-calendar.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ui-calendar.position-top {
    top: auto;
    bottom: calc(100% + 6px);
}

.ui-calendar.position-right {
    left: auto;
    right: 0;
}

/* Calendar Header */
.ui-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 8px;
}

.ui-calendar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ui-calendar-nav-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: all 0.15s ease;
}

.ui-calendar-nav-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.ui-calendar-nav-btn svg {
    width: 16px;
    height: 16px;
}

/* Dropdowns para mês e ano - Design igual ao animated select */
.ui-calendar-selects {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.ui-calendar-select {
    padding: 8px 12px;
    padding-right: 32px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--foreground, #1e293b);
    background: var(--background, #ffffff);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ui-calendar-select:hover {
    border-color: var(--ring, #94a3b8);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.ui-calendar-select:focus {
    outline: none;
    border-color: var(--ring, #1f2937);
    box-shadow: 0 0 0 2px var(--background, #fff), 0 0 0 3px var(--ring, #1f2937);
}

.ui-calendar-select-month {
    min-width: 120px;
}

.ui-calendar-select-year {
    min-width: 85px;
}

/* Estilização das opções do select */
.ui-calendar-select option {
    padding: 8px 12px;
    font-size: 0.8125rem;
    font-weight: 500;
    background: var(--background, #ffffff);
    color: var(--foreground, #1e293b);
}

.ui-calendar-select option:checked {
    background: var(--accent, #f1f5f9);
}

/* Calendar Grid */
.ui-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 6px;
}

.ui-calendar-weekday {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    padding: 6px 0;
}

.ui-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.ui-calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: #1e293b;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    min-width: 36px;
    min-height: 36px;
}

.ui-calendar-day:hover:not(.disabled):not(.selected) {
    background: #f1f5f9;
}

.ui-calendar-day.other-month {
    color: #cbd5e1;
}

.ui-calendar-day.today {
    background: #f1f5f9;
    font-weight: 600;
}

.ui-calendar-day.selected {
    background: #2563eb;
    color: white;
    font-weight: 600;
}

.ui-calendar-day.selected:hover {
    background: #1d4ed8;
}

.ui-calendar-day.disabled {
    color: #e2e8f0;
    cursor: not-allowed;
}

/* Calendar Footer */
.ui-calendar-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
}

.ui-calendar-today-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #2563eb;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ui-calendar-today-btn:hover {
    background: #eff6ff;
}

.ui-calendar-clear-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #64748b;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ui-calendar-clear-btn:hover {
    background: #f1f5f9;
    color: #ef4444;
}

/* ==================== DATETIME PICKER ==================== */

.ui-calendar-time {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
}

.ui-calendar-time-input {
    width: 60px;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: center;
    color: #1e293b;
}

.ui-calendar-time-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.ui-calendar-time-separator {
    font-size: 1rem;
    font-weight: 600;
    color: #64748b;
}

/* ==================== SAVE BUTTON - SHADCN GRADIENT STYLE ==================== */

/* Classe base para botão de salvar com gradiente animado */
.btn-save-gradient {
    background: transparent;
    background-image: linear-gradient(to right, hsl(221 83% 53%), hsl(221 83% 53% / 0.7), hsl(221 83% 53%));
    background-size: 200% auto;
    background-position: 0% center;
    color: white !important;
    border: none;
    font-weight: 600;
    transition: background-position 0.3s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.btn-save-gradient:hover {
    background-position: 99% center;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px hsl(221 83% 53% / 0.4);
}

.btn-save-gradient:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px hsl(221 83% 53% / 0.3);
}

.btn-save-gradient:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px hsl(221 83% 53% / 0.25);
}

.btn-save-gradient:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.dark .btn-save-gradient:focus-visible {
    box-shadow: 0 0 0 3px hsl(221 83% 53% / 0.4);
}

/* Variante outline com gradiente no hover */
.btn-save-outline-gradient {
    background: transparent;
    border: 1px solid hsl(221 83% 53%);
    color: hsl(221 83% 53%);
    position: relative;
    overflow: hidden;
    font-weight: 600;
    transition: color 0.3s ease, border-color 0.3s ease, transform 0.15s ease;
}

.btn-save-outline-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: linear-gradient(to right, hsl(221 83% 53%), hsl(221 83% 53% / 0.7), hsl(221 83% 53%));
    background-size: 200% auto;
    background-position: 0% center;
    opacity: 0;
    transition: opacity 0.3s ease, background-position 0.3s ease;
    z-index: -1;
}

.btn-save-outline-gradient:hover {
    color: white;
    border-color: transparent;
    transform: translateY(-1px);
}

.btn-save-outline-gradient:hover::before {
    opacity: 1;
    background-position: 99% center;
}

/* ==================== DELETE BUTTON - SHADCN GRADIENT STYLE ==================== */

/* Classe base para botão de delete com gradiente animado */
.btn-delete-gradient {
    background: transparent;
    background-image: linear-gradient(to right, hsl(0 84.2% 60.2%), hsl(0 84.2% 60.2% / 0.6), hsl(0 84.2% 60.2%));
    background-size: 200% auto;
    background-position: 0% center;
    color: white !important;
    border: none;
    transition: background-position 0.3s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.btn-delete-gradient:hover {
    background-position: 99% center;
    transform: translateY(-1px);
}

.btn-delete-gradient:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px hsl(0 84.2% 60.2% / 0.2);
}

.dark .btn-delete-gradient:focus-visible {
    box-shadow: 0 0 0 3px hsl(0 84.2% 60.2% / 0.4);
}

/* Variante para ícones pequenos */
.btn-icon-delete-gradient {
    background: transparent;
    background-image: linear-gradient(to right, hsl(0 84.2% 60.2%), hsl(0 84.2% 60.2% / 0.6), hsl(0 84.2% 60.2%));
    background-size: 200% auto;
    background-position: 0% center;
    color: white !important;
    border: none;
    transition: background-position 0.3s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.btn-icon-delete-gradient:hover {
    background-position: 99% center;
    transform: scale(1.05);
}

.btn-icon-delete-gradient:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px hsl(0 84.2% 60.2% / 0.2);
}

/* Variante outline com gradiente no hover */
.btn-delete-outline-gradient {
    background: transparent;
    border: 1px solid hsl(0 84.2% 60.2%);
    color: hsl(0 84.2% 60.2%);
    position: relative;
    overflow: hidden;
    transition: color 0.3s ease, border-color 0.3s ease, transform 0.15s ease;
}

.btn-delete-outline-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: linear-gradient(to right, hsl(0 84.2% 60.2%), hsl(0 84.2% 60.2% / 0.6), hsl(0 84.2% 60.2%));
    background-size: 200% auto;
    background-position: 0% center;
    opacity: 0;
    transition: opacity 0.3s ease, background-position 0.3s ease;
    z-index: -1;
}

.btn-delete-outline-gradient:hover {
    color: white;
    border-color: transparent;
    transform: translateY(-1px);
}

.btn-delete-outline-gradient:hover::before {
    opacity: 1;
    background-position: 99% center;
}

/* ==================== PAGINATION - SHADCN STYLE ==================== */

.ui-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
}

.ui-pagination-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
}

.ui-pagination-item {
    display: inline-flex;
}

.ui-pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary, #1e293b);
    background: transparent;
    border: 1px solid var(--border-color, #e2e8f0);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.ui-pagination-link:hover:not(:disabled):not(.active) {
    background: var(--bg-hover, #f1f5f9);
    border-color: var(--border-color, #cbd5e1);
}

.ui-pagination-link.active {
    background: var(--primary, hsl(221 83% 53%));
    border-color: var(--primary, hsl(221 83% 53%));
    color: white;
    font-weight: 600;
}

.ui-pagination-link:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.ui-pagination-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px hsl(221 83% 53% / 0.25);
}

/* Icon buttons (prev/next) */
.ui-pagination-link.icon-only {
    padding: 0;
    width: 36px;
}

.ui-pagination-link svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Ellipsis */
.ui-pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    color: var(--text-secondary, #64748b);
    font-size: 0.875rem;
    letter-spacing: 2px;
}

/* Pagination info text */
.ui-pagination-info {
    font-size: 0.8125rem;
    color: var(--text-secondary, #64748b);
    margin-right: 12px;
}

/* Container with info and controls */
.ui-pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    gap: 16px;
    flex-wrap: wrap;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 480px) {
    #toast-container {
        left: 10px;
        right: 10px;
        top: 10px;
    }

    .ui-toast {
        min-width: auto;
        width: 100%;
    }

    .ui-confirm-box {
        padding: 24px;
    }

    .ui-confirm-buttons {
        flex-direction: column;
    }

    .ui-btn {
        width: 100%;
    }

    .ui-calendar {
        left: 50%;
        transform: translateX(-50%) translateY(-8px);
        min-width: calc(100vw - 32px);
        max-width: 320px;
    }

    .ui-calendar.show {
        transform: translateX(-50%) translateY(0);
    }

    /* Pagination responsive */
    .ui-pagination-wrapper {
        flex-direction: column;
        gap: 12px;
    }

    .ui-pagination-info {
        margin-right: 0;
    }

    .ui-pagination-link {
        min-width: 32px;
        height: 32px;
        padding: 0 8px;
        font-size: 0.8125rem;
    }

    .ui-pagination-link.icon-only {
        width: 32px;
    }

    .ui-pagination-ellipsis {
        min-width: 28px;
    }
}