/* ====================================
   REUSABLE UI COMPONENTS
   Common patterns shared across pages
   ==================================== */

/* BUTTON STYLES */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: #0066cc;
    color: white;
}

.btn-primary:hover {
    background: #0052a3;
    box-shadow: 0 6px 20px rgba(0, 102, 204, 0.3);
}

.btn-secondary {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-light {
    background: white;
    color: #0f172a;
    border: 1px solid #e2e8f0;
}

.btn-light:hover {
    background: #f8fafc;
}

/* CARD STYLES */
.card,
.tool-card,
.dashboard-card {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover,
.tool-card:hover,
.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.card h3,
.tool-card h3,
.dashboard-card h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #0f172a;
}

/* STAT CARD */
.stat-card {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.8rem;
    opacity: 0.9;
}

/* GRID LAYOUTS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.grid {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-auto {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* FORM STYLES */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #0f172a;
}

.form-control,
.edifact-input,
textarea,
input[type="text"],
input[type="email"],
input[type="number"],
select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #f8fafc;
}

.form-control:focus,
.edifact-input:focus,
textarea:focus,
input:focus,
select:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
    background: white;
}

textarea {
    resize: vertical;
}

/* TABLE STYLES */
table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

table th {
    background: linear-gradient(135deg, #0066cc, #004499);
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
}

table td {
    padding: 15px;
    border-bottom: 1px solid #e2e8f0;
    background: white;
}

table tbody tr:hover td {
    background: #f8fafc;
}

/* MODAL / DIALOG STYLES */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active,
.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #0f172a;
}

/* LOADING ANIMATION */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0066cc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0066cc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* NOTIFICATION STYLES */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    z-index: 1000;
    animation: slideInRight 0.3s ease;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.notification.success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.notification.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.notification.warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.notification.info {
    background: linear-gradient(135deg, #0066cc, #0052a3);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* TABS STYLES */
.tab-group {
    display: flex;
    gap: 5px;
    margin-bottom: 25px;
    background: #f8fafc;
    border-radius: 12px;
    padding: 5px;
    flex-wrap: wrap;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #64748b;
    white-space: nowrap;
    flex: 1;
    min-width: 120px;
}

.tab-btn.active {
    background: #0066cc;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animation-fade-in {
    animation: fadeIn 0.3s ease;
}

.animation-slide-in {
    animation: slideUp 0.3s ease;
}

/* TEXT UTILITIES */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: #64748b;
}

.text-error {
    color: #dc2626;
}

.text-success {
    color: #10b981;
}

.text-warning {
    color: #f59e0b;
}

/* SPACING UTILITIES */
.mt-0 {
    margin-top: 0;
}
.mt-1 {
    margin-top: 8px;
}
.mt-2 {
    margin-top: 16px;
}
.mt-3 {
    margin-top: 24px;
}
.mt-4 {
    margin-top: 32px;
}

.mb-0 {
    margin-bottom: 0;
}
.mb-1 {
    margin-bottom: 8px;
}
.mb-2 {
    margin-bottom: 16px;
}
.mb-3 {
    margin-bottom: 24px;
}
.mb-4 {
    margin-bottom: 32px;
}

.p-1 {
    padding: 8px;
}
.p-2 {
    padding: 16px;
}
.p-3 {
    padding: 24px;
}

/* VALIDATION STYLES */
.validation-result {
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    animation: slideUp 0.3s ease;
}

.validation-result.valid {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 1px solid #bbf7d0;
    color: #166534;
}

.validation-result.invalid {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* HIGHLIGHT STYLES */
.error-highlight {
    background: #dc2626;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    margin-right: 5px;
}

.warning-highlight {
    background: #d97706;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    margin-right: 5px;
}

.success-highlight {
    background: #10b981;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

/* BADGE STYLES */
.badge {
    display: inline-block;
    padding: 6px 16px;
    background: linear-gradient(135deg, #0066cc, #004499);
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge.success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.badge.danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.badge.warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* RESPONSIVE ADJUSTMENTS */
@media (max-width: 768px) {
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn-group .btn {
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .grid-cols-2,
    .grid-cols-3 {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
    }

    table {
        font-size: 0.9rem;
    }

    table th,
    table td {
        padding: 10px;
    }

    .notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}