/* ============================================
   InvestifySL Base Styles
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    color: var(--text);
    background-color: var(--background);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    outline: none;
}

input,
select,
textarea {
    font-family: inherit;
    font-size: var(--font-size-base);
    outline: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    line-height: 1.3;
    font-weight: 700;
    color: var(--text);
}

ul,
ol {
    list-style: none;
}

/* ============================================
   Utility Classes
   ============================================ */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-size: var(--font-size-sm);
    font-weight: 600;
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
    box-shadow: 0 4px 14px rgba(15, 76, 117, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(15, 76, 117, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--white);
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: var(--primary);
    font-weight: 700;
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: var(--white);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: var(--white);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--font-size-base);
    border-radius: var(--radius-xl);
}

.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-size-xs);
}

.btn-block {
    width: 100%;
}

.btn:disabled,
.btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================
   Form Elements
   ============================================ */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--space-2);
}

.form-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    background: var(--white);
    color: var(--text);
    font-size: var(--font-size-base);
    transition: all var(--transition-fast);
}

.form-input:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(50, 130, 184, 0.15);
}

.form-input::placeholder {
    color: var(--gray-400);
}

.form-input.error {
    border-color: var(--danger);
}

.form-hint {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.form-error {
    font-size: var(--font-size-xs);
    color: var(--danger);
    margin-top: var(--space-1);
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    padding: var(--space-6);
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-card-hover);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.card-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
}

/* ============================================
   Badges
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-size-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
}

.badge-success {
    background: var(--success-bg);
    color: #065f46;
}

.badge-warning {
    background: var(--warning-bg);
    color: #92400e;
}

.badge-danger {
    background: var(--danger-bg);
    color: #991b1b;
}

.badge-info {
    background: var(--info-bg);
    color: #1e40af;
}

.badge-primary {
    background: rgba(15, 76, 117, 0.1);
    color: var(--primary);
}

/* ============================================
   Tables
   ============================================ */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.table th {
    background: var(--gray-50);
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-weight: 600;
    color: var(--text-light);
    border-bottom: 2px solid var(--gray-200);
}

.table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--gray-100);
}

.table tr:hover td {
    background: var(--gray-50);
}

/* ============================================
   Loading Spinner
   ============================================ */
.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-dark {
    border-color: rgba(15, 76, 117, 0.2);
    border-top-color: var(--primary);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.page-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    max-width: 400px;
    width: calc(100% - 2rem);
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    background: var(--white);
    box-shadow: var(--shadow-xl);
    animation: slideInRight 0.3s ease;
    border-left: 4px solid;
}

.toast-success {
    border-color: var(--success);
}

.toast-error {
    border-color: var(--danger);
}

.toast-warning {
    border-color: var(--warning);
}

.toast-info {
    border-color: var(--info);
}

.toast-icon {
    font-size: var(--font-size-xl);
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.toast-message {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 2px;
}

.toast-close {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-size: var(--font-size-lg);
    padding: 0;
    line-height: 1;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ============================================
   Modal
   ============================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    transition: opacity var(--transition-base);
    display: none;
}

.modal-backdrop.active {
    display: block;
    opacity: 1;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-modal);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    opacity: 0;
    transition: all var(--transition-base);
    display: none;
}

.modal.active {
    display: block;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-6);
    border-bottom: 1px solid var(--gray-100);
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--gray-100);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }

    .container {
        padding: 0 var(--space-3);
    }
}