/* ============================================
   NotaCollect App - Components
   ============================================ */

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(4, 118, 224, 0.3);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-200);
}

.btn-outline {
    background: transparent;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-outline:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

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

.btn-success:hover:not(:disabled) {
    background: #059669;
}

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

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--gray-100);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
}

.btn-icon.btn-sm {
    width: 28px;
    height: 28px;
}

/* ============================================
   Forms
   ============================================ */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-label.required::after {
    content: ' *';
    color: var(--error);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: inherit;
    color: var(--gray-900);
    background: var(--white);
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--gray-400);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
    border-color: var(--error);
}

.form-input.error:focus,
.form-select.error:focus,
.form-textarea.error:focus {
    box-shadow: 0 0 0 3px var(--error-light);
}

.form-error {
    font-size: 12px;
    color: var(--error);
    margin-top: 4px;
}

.form-hint {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
}

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

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

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.form-check-label {
    font-size: 14px;
    color: var(--gray-700);
}

/* Input Group */
.input-group {
    display: flex;
}

.input-group .form-input {
    border-radius: 0;
}

.input-group .form-input:first-child {
    border-radius: var(--border-radius) 0 0 var(--border-radius);
}

.input-group .form-input:last-child {
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.input-group .btn {
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.input-group-text {
    padding: 10px 14px;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-right: none;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    font-size: 14px;
    color: var(--gray-500);
}

/* ============================================
   Cards
   ============================================ */

.card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

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

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* ============================================
   Tables
   ============================================ */

.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    background: var(--gray-50);
}

.table tbody tr {
    transition: var(--transition);
}

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

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

.table-clickable tbody tr {
    cursor: pointer;
}

/* ============================================
   Badges
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: #92400e;
}

.badge-error {
    background: var(--error-light);
    color: var(--error);
}

.badge-gray {
    background: var(--gray-200);
    color: var(--gray-600);
}

/* ============================================
   Progress Bar
   ============================================ */

.progress {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-bar.success {
    background: var(--success);
}

.progress-bar.warning {
    background: var(--warning);
}

.progress-bar.error {
    background: var(--error);
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
}

/* ============================================
   Modals
   ============================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

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

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    color: var(--gray-500);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--gray-50);
}

/* ============================================
   Dropzone
   ============================================ */

.dropzone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.dropzone-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--gray-400);
}

.dropzone:hover .dropzone-icon,
.dropzone.dragover .dropzone-icon {
    background: var(--primary);
    color: var(--white);
}

.dropzone-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.dropzone-hint {
    font-size: 14px;
    color: var(--gray-500);
}

/* ============================================
   Alerts
   ============================================ */

.alert {
    padding: 16px 20px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.alert-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.alert-message {
    font-size: 14px;
}

.alert-info {
    background: var(--info-light);
    color: #1e40af;
}

.alert-success {
    background: var(--success-light);
    color: #065f46;
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
}

.alert-error {
    background: var(--error-light);
    color: #991b1b;
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 16px 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 320px;
    max-width: 420px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-success .toast-icon {
    color: var(--success);
}

.toast-error .toast-icon {
    color: var(--error);
}

.toast-warning .toast-icon {
    color: var(--warning);
}

.toast-info .toast-icon {
    color: var(--info);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13px;
    color: var(--gray-500);
}

.toast-close {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px;
}

.toast-close:hover {
    color: var(--gray-600);
}

/* ============================================
   Tabs
   ============================================ */

.tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 24px;
}

.tab {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-500);
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.tab:hover {
    color: var(--gray-700);
}

.tab.active {
    color: var(--primary);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============================================
   Steps
   ============================================ */

.steps {
    display: flex;
    margin-bottom: 32px;
}

.step {
    flex: 1;
    display: flex;
    align-items: center;
    position: relative;
}

.step:not(:last-child)::after {
    content: '';
    flex: 1;
    height: 2px;
    background: var(--gray-300);
    margin: 0 16px;
}

.step.completed:not(:last-child)::after {
    background: var(--primary);
}

.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    background: var(--gray-200);
    color: var(--gray-500);
    flex-shrink: 0;
}

.step.active .step-number {
    background: var(--primary);
    color: var(--white);
}

.step.completed .step-number {
    background: var(--primary);
    color: var(--white);
}

.step-label {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    font-size: 12px;
    color: var(--gray-500);
    white-space: nowrap;
}

.step.active .step-label {
    color: var(--primary);
    font-weight: 500;
}

/* ============================================
   Timeline
   ============================================ */

.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gray-200);
}

.timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -24px;
    top: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--white);
    border: 2px solid var(--gray-300);
}

.timeline-item.success .timeline-dot {
    border-color: var(--success);
    background: var(--success);
}

.timeline-item.primary .timeline-dot {
    border-color: var(--primary);
    background: var(--primary);
}

.timeline-time {
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.timeline-content {
    font-size: 14px;
    color: var(--gray-700);
}

/* ============================================
   Empty State
   ============================================ */

.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--gray-400);
}

.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.empty-state-text {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 24px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   Pagination
   ============================================ */

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

.pagination-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
    background: var(--white);
    border: 1px solid var(--gray-300);
    cursor: pointer;
    transition: var(--transition);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

/* ============================================
   Avatar
   ============================================ */

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--white);
    flex-shrink: 0;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 12px;
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 20px;
}

.avatar-xl {
    width: 80px;
    height: 80px;
    font-size: 28px;
}

/* ============================================
   Filters Bar
   ============================================ */

.filters-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-label {
    font-size: 13px;
    color: var(--gray-500);
}

.filter-select {
    padding: 8px 32px 8px 12px;
    font-size: 13px;
}

.filter-search {
    flex: 1;
    max-width: 300px;
}

/* ============================================
   Document List
   ============================================ */

.document-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.document-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.document-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.document-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius);
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--gray-500);
}

.document-item.received .document-icon {
    background: var(--success-light);
    color: var(--success);
}

.document-item.pending .document-icon {
    background: var(--warning-light);
    color: var(--warning);
}

.document-item.rejected .document-icon {
    background: var(--error-light);
    color: var(--error);
}

.document-info {
    flex: 1;
    min-width: 0;
}

.document-name {
    font-weight: 500;
    color: var(--gray-900);
    margin-bottom: 2px;
}

.document-meta {
    font-size: 12px;
    color: var(--gray-500);
}

.document-actions {
    display: flex;
    gap: 8px;
}

/* ============================================
   Utilities
   ============================================ */

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

.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
.text-muted { color: var(--gray-500); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 24px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 24px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.hidden { display: none; }
.visible { display: block; }
