/**
 * QoriCash Trading V2 - Main Styles Premium
 * Diseño profesional inspirado en la pantalla de login
 */

/* Variables CSS Premium */
:root {
    --primary-color: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #6366f1;
    --secondary-color: #7c3aed;
    --success-color: #10b981;
    --success-dark: #059669;
    --danger-color: #ef4444;
    --danger-dark: #dc2626;
    --warning-color: #f59e0b;
    --warning-dark: #d97706;
    --info-color: #3b82f6;
    --info-dark: #2563eb;
    --light-color: #f8fafc;
    --dark-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.15);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.2);
}

/* Global Styles Premium */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #334155;
    position: relative;
}

/* Animated background subtle */
body::before {
    content: '';
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(79, 70, 229, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(124, 58, 237, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

html, body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Container optimizado */
.container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
    max-width: 100%;
    position: relative;
    z-index: auto;
}

main.container-fluid {
    padding-top: 1.25rem;
    padding-bottom: 1.25rem;
}

/* Navbar Premium */
.navbar {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 0.5rem 1rem;
    position: relative;
    z-index: 1030;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: -0.025em;
    transition: all 0.3s;
}

.navbar-brand:hover {
    transform: translateX(2px);
}

.nav-link {
    padding: 0.5rem 0.875rem !important;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s;
}

.nav-link:hover::before {
    left: 100%;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.1);
    transform: translateY(-1px);
}

/* Cards Premium */
.card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    background: white;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.3s;
}

.card:hover::before {
    opacity: 1;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    padding: 0.875rem 1.125rem;
    font-size: 0.9375rem;
}

.card-body {
    padding: 1.125rem;
}

.card-link {
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.card-link:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* Stat Cards Premium */
.stat-card {
    border-radius: 12px;
    border: none;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 150%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 60%);
    animation: shimmer 4s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translateX(0) translateY(0); opacity: 0.5; }
    50% { transform: translateX(-10px) translateY(-10px); opacity: 0.8; }
}

.stat-card .card-body {
    padding: 1rem;
    position: relative;
    z-index: 1;
}

.stat-card .card-subtitle {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
}

.stat-card .card-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0.25rem 0 0 0;
    animation: countUp 0.5s ease-out;
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.stat-icon {
    font-size: 2.25rem;
    opacity: 0.25;
}

/* Tables Premium */
.table {
    background-color: white;
    font-size: 0.8125rem;
    margin-bottom: 0;
    border-radius: 8px;
    overflow: hidden;
}

.table thead th {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    color: var(--dark-color);
    padding: 0.75rem 0.875rem;
    letter-spacing: 0.025em;
}

.table tbody td {
    padding: 0.75rem 0.875rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.2s;
}

.table-hover tbody tr {
    transition: all 0.2s;
}

.table-hover tbody tr:hover {
    background-color: #f8fafc;
    transform: scale(1.005);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.table-sm th,
.table-sm td {
    padding: 0.5rem 0.625rem;
}

/* Badges Premium */
.badge {
    padding: 0.375em 0.75em;
    font-weight: 500;
    font-size: 0.75rem;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Buttons Premium */
.btn {
    border-radius: 8px;
    padding: 0.625rem 1.125rem;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.3s;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-sm {
    padding: 0.4rem 0.875rem;
    font-size: 0.8125rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--secondary-color) 100%);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, var(--success-dark) 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, var(--danger-dark) 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, var(--warning-dark) 100%);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-info {
    background: linear-gradient(135deg, var(--info-color) 0%, var(--info-dark) 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

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

.btn-group-sm .btn {
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
}

/* Forms Premium */
.form-control,
.form-select {
    border-radius: 8px;
    border: 2px solid var(--border-color);
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    transition: all 0.3s;
    background-color: #f8fafc;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    background-color: white;
}

.form-control::placeholder {
    color: #94a3b8;
}

.form-control-sm {
    padding: 0.4rem 0.7rem;
    font-size: 0.8125rem;
}

.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
    font-size: 0.875rem;
}

.input-group-text {
    font-size: 0.875rem;
    padding: 0.625rem 0.875rem;
    background-color: #f8fafc;
    border: 2px solid var(--border-color);
}

/* Modals Premium */
.modal {
    z-index: 1055 !important;
}

.modal-backdrop {
    z-index: 1050 !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
}

.modal-backdrop.show {
    opacity: 0.5 !important;
}

.modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: var(--shadow-xl);
    position: relative;
    z-index: 1056;
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, white 100%);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark-color);
}

.modal-body {
    padding: 1.5rem;
    background-color: white;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    background-color: #f8fafc;
}

/* Alerts Premium */
.alert {
    border-radius: 8px;
    border: none;
    padding: 0.875rem 1.125rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
    border-left: 4px solid var(--success-color);
    color: var(--success-dark);
}

.alert-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
    border-left: 4px solid var(--danger-color);
    color: var(--danger-dark);
}

.alert-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.05) 100%);
    border-left: 4px solid var(--warning-color);
    color: var(--warning-dark);
}

.alert-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
    border-left: 4px solid var(--info-color);
    color: var(--info-dark);
}

/* Footer Premium */
.footer {
    background: linear-gradient(135deg, #f8fafc 0%, white 100%);
    border-top: 1px solid var(--border-color);
    padding: 1.25rem 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
}

/* DataTables Premium */
.dataTables_wrapper {
    font-size: 0.875rem;
}

.dataTables_wrapper .dataTables_filter input {
    border-radius: 8px;
    padding: 0.5rem 0.875rem;
    border: 2px solid var(--border-color);
    font-size: 0.875rem;
    transition: all 0.3s;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.dataTables_wrapper .dataTables_length select {
    border-radius: 8px;
    padding: 0.5rem 0.875rem;
    border: 2px solid var(--border-color);
    font-size: 0.875rem;
}

.dataTables_wrapper .dataTables_info {
    font-size: 0.8125rem;
    padding-top: 0.75rem;
}

.dataTables_wrapper .dataTables_paginate {
    padding-top: 0.75rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
}

/* Headings Premium */
h1, h2, h3, h4, h5, h6 {
    color: var(--dark-color);
    font-weight: 700;
}

h1 { font-size: 1.75rem; margin-bottom: 1rem; }
h2 { font-size: 1.5rem; margin-bottom: 0.875rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.75rem; }
h4 { font-size: 1.125rem; margin-bottom: 0.625rem; }
h5 { font-size: 1rem; margin-bottom: 0.5rem; }
h6 { font-size: 0.875rem; margin-bottom: 0.5rem; }

/* Spacing */
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }

.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }

/* Rows */
.row {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

.row > * {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* Utilidades */
.text-muted {
    color: var(--text-muted) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

.bg-light {
    background-color: var(--light-color) !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--secondary-color));
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

.slide-in {
    animation: slideIn 0.4s ease-out;
}

.scale-in {
    animation: scaleIn 0.3s ease-out;
}

/* Loading Spinner */
.spinner-border {
    width: 2rem;
    height: 2rem;
    border-width: 0.25em;
}

/* Dropdown Premium */
.dropdown-menu {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    animation: scaleIn 0.2s ease-out;
    z-index: 1060 !important;
    background-color: white;
    position: absolute !important;
}

.dropdown-item {
    border-radius: 6px;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    transition: all 0.2s;
    position: relative;
    z-index: 1061;
}

.dropdown-item:hover {
    background-color: #f8fafc;
    color: var(--primary-color);
}

.dropdown-item:active {
    background-color: var(--primary-color);
    color: white;
}

/* Navbar dropdown específico */
.navbar .dropdown-menu {
    margin-top: 0.5rem;
}

.navbar .dropdown-toggle::after {
    margin-left: 0.5rem;
}

/* Progress Bar Premium */
.progress {
    height: 8px;
    border-radius: 10px;
    background-color: #e2e8f0;
    overflow: hidden;
}

.progress-bar {
    border-radius: 10px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    animation: progressSlide 1s ease-out;
}

@keyframes progressSlide {
    from { width: 0; }
}

/* Responsive */
@media (max-width: 768px) {
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .card-body {
        padding: 0.875rem;
    }

    .table {
        font-size: 0.75rem;
    }

    .btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
    }
}

/* Notification Badge for Notes (WhatsApp style) */
.btn.position-relative {
    overflow: visible !important;
}

.btn-group {
    overflow: visible !important;
}

.notes-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 10px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    white-space: nowrap;
    border-radius: 9px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 10;
    pointer-events: none;
}

/* Asegurar que el badge se vea completamente */
.table td {
    position: relative;
    overflow: visible !important;
}

.btn-group-sm {
    overflow: visible !important;
}

/* Resaltar operaciones "En proceso" */
tr[data-status="En proceso"] {
    background-color: rgba(13, 202, 240, 0.08) !important;
    border-left: 4px solid #0dcaf0 !important;
}

tr[data-status="En proceso"]:hover {
    background-color: rgba(13, 202, 240, 0.15) !important;
}

/* Print Styles */
@media print {
    .navbar, .btn, .footer, .modal { display: none !important; }
    .card { box-shadow: none; border: 1px solid #dee2e6; page-break-inside: avoid; }
    body { background: white; }
    body::before { display: none; }
    .notes-badge { display: none !important; }
}
