/**
 * Global Styles for DataInvest Application
 * Modern, responsive design with Tailwind CSS
 */

/* ============================================================
   ROOT VARIABLES
   ============================================================ */
:root {
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #6366f1;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08);
    --shadow-card: 0 2px 12px rgba(30, 41, 59, 0.08);
    --radius: 10px;
    --radius-lg: 14px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   BODY & TEXT
   ============================================================ */
body {
    font-family: 'DM Sans', system-ui, sans-serif;
    color: #374151;
    line-height: 1.6;
    scroll-behavior: smooth;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 600;
    line-height: 1.3;
    color: #111827;
}

/* ============================================================
   CARD COMPONENT
   ============================================================ */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 1.5rem;
    transition: var(--transition);
}

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

.card-compact {
    padding: 1rem;
}

.card-lg {
    padding: 2rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

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

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

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

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

.btn-secondary {
    background-color: var(--gray-200);
    color: var(--gray-800);
}

.btn-secondary:hover {
    background-color: var(--gray-300);
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-outline {
    border: 2px solid currentColor;
    background-color: transparent;
}

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

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1.0625rem;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: 0.5rem;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group label .required {
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--gray-900);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-control[type="checkbox"],
.form-control[type="radio"] {
    width: auto;
    margin-right: 0.5rem;
}

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

.form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.form-text.error {
    color: var(--danger);
}

/* ============================================================
   INPUT VALIDATION
   ============================================================ */
.form-control:invalid {
    border-color: var(--danger);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-control.is-valid {
    border-color: var(--success);
}

.invalid-feedback,
.valid-feedback {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
}

.invalid-feedback {
    color: var(--danger);
}

.valid-feedback {
    color: var(--success);
}

/* ============================================================
   TABLES
   ============================================================ */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.table thead {
    background-color: var(--gray-100);
}

.table th {
    padding: 0.875rem;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
}

.table td {
    padding: 0.875rem;
    border-bottom: 1px solid var(--gray-200);
}

.table tbody tr:hover {
    background-color: var(--gray-50);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

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

.table-striped tbody tr:nth-child(even) {
    background-color: var(--gray-50);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 2px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-primary {
    background-color: rgba(37, 99, 235, 0.15);
    color: var(--primary-dark);
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.15);
    color: #065f46;
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.15);
    color: #7f1d1d;
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.15);
    color: #78350f;
}

.badge-info {
    background-color: rgba(99, 102, 241, 0.15);
    color: #312e81;
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    border-left: 4px solid;
    margin-bottom: 1rem;
}

.alert-primary {
    background-color: rgba(37, 99, 235, 0.1);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
    color: #065f46;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: #7f1d1d;
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    border-color: var(--warning);
    color: #78350f;
}

.alert-info {
    background-color: rgba(99, 102, 241, 0.1);
    border-color: var(--info);
    color: #312e81;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.page-item {
    display: flex;
}

.page-link {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}

.page-link:hover {
    background-color: var(--gray-100);
    border-color: var(--primary);
}

.page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

.page-item.disabled .page-link {
    color: var(--gray-400);
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================================
   MODALS / OVERLAYS
   ============================================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--gray-500);
}

.text-danger {
    color: var(--danger);
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

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

.bg-light {
    background-color: var(--gray-100);
}

.bg-dark {
    background-color: var(--gray-900);
}

.border-top {
    border-top: 1px solid var(--gray-200);
}

.border-bottom {
    border-bottom: 1px solid var(--gray-200);
}

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }

.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }

.hidden { display: none; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

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

.animate-fade-in {
    animation: fadeIn 0.3s ease-in;
}

.animate-slide-in-up {
    animation: slideInUp 0.4s ease-out;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ============================================================
   RESPONSIVE UTILITIES
   ============================================================ */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .table {
        font-size: 0.875rem;
    }

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

    .card {
        padding: 1rem;
    }

    .modal-content {
        width: 95%;
    }
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-color-scheme: dark) {
    body {
        background-color: #1f2937;
        color: #f3f4f6;
    }

    .card {
        background-color: #374151;
        color: #f3f4f6;
    }

    .form-control {
        background-color: #4b5563;
        border-color: #6b7280;
        color: #f3f4f6;
    }

    .table {
        color: #f3f4f6;
    }

    .table thead {
        background-color: #4b5563;
    }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .no-print {
        display: none;
    }

    body {
        background-color: white;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
