/**
 * Custom CSS Styles
 * Tailwind CSS supplements and custom animations
 */

/* Root Variables */
:root {
    --primary-color: #4f46e5;
    --primary-dark: #4338ca;
    --secondary-color: #1e40af;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --gray-light: #f9fafb;
    --gray-dark: #111827;
    --transition: all 0.3s ease;
}

/* Typography */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

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

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

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

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

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

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

/* Animation Utility Classes */
.animate-fade-in {
    animation: fadeIn 0.3s ease forwards;
}

.animate-slide-in-down {
    animation: slideInDown 0.3s ease forwards;
}

.animate-slide-in-up {
    animation: slideInUp 0.3s ease forwards;
}

.animate-slide-in-left {
    animation: slideInLeft 0.3s ease forwards;
}

.animate-slide-in-right {
    animation: slideInRight 0.3s ease forwards;
}

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

.animate-bounce {
    animation: bounce 1s infinite;
}

.animate-shake {
    animation: shake 0.5s ease;
}

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

/* Fade in on load */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Smooth transitions */
* {
    transition: background-color var(--transition), color var(--transition), border-color var(--transition);
}

/* Form Styles */
input:focus,
select:focus,
textarea:focus {
    outline: none;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
select,
textarea {
    transition: all 0.3s ease;
}

/* Form field error state */
input.border-red-500,
select.border-red-500,
textarea.border-red-500 {
    animation: shake 0.3s ease;
}

/* Placeholder styles */
::placeholder {
    color: #d1d5db;
}

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

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Button Styles */
button {
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

button:active {
    transform: scale(0.98);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Card Styles */
.card {
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Badge Styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-success {
    background-color: #dcfce7;
    color: #166534;
}

.badge-error {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-pending {
    background-color: #fef08a;
    color: #713f12;
}

/* Alert Styles */
.alert {
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #f0fdf4;
    border-color: #22c55e;
    color: #166534;
}

.alert-error {
    background-color: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
}

.alert-warning {
    background-color: #fffbeb;
    border-color: #f59e0b;
    color: #92400e;
}

.alert-info {
    background-color: #f0f9ff;
    border-color: #3b82f6;
    color: #1e40af;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(79, 70, 229, 0.2);
    border-radius: 50%;
    border-top-color: #4f46e5;
    animation: spin 1s linear infinite;
}

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

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, #3b82f6);
    transition: width 0.3s ease;
    border-radius: 9999px;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background-color: #f9fafb;
}

table th {
    padding: 0.75rem 1.5rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

table td {
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

table tbody tr:hover {
    background-color: #f9fafb;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: white;
    border-radius: 0.75rem;
    padding: 2rem;
    max-width: 90%;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideInUp 0.3s ease;
}

/* Responsive Typography */
@media (max-width: 768px) {
    h1 {
        font-size: 1.875rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }
}

/* Responsive Grid */
@media (max-width: 640px) {
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
    }
}

/* Print Styles */
@media print {
    body {
        background-color: white;
    }

    .no-print {
        display: none;
    }

    a {
        color: #000;
        text-decoration: underline;
    }
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
    body {
        background-color: var(--gray-dark);
        color: #f3f4f6;
    }

    input,
    select,
    textarea {
        background-color: #1f2937;
        color: #f3f4f6;
        border-color: #374151;
    }

    .card {
        background-color: #1f2937;
        color: #f3f4f6;
    }

    table thead {
        background-color: #111827;
    }

    table th {
        color: #d1d5db;
        border-bottom-color: #374151;
    }

    table td {
        border-bottom-color: #374151;
    }
}

/* Utility Classes */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Gradient Backgrounds */
.gradient-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.gradient-success {
    background: linear-gradient(135deg, var(--success-color), #059669);
}

.gradient-error {
    background: linear-gradient(135deg, var(--error-color), #dc2626);
}

/* Flex Utilities */
.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Responsive Utilities */
.mobile-only {
    display: none;
}

@media (max-width: 640px) {
    .mobile-only {
        display: block;
    }

    .mobile-hidden {
        display: none !important;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus Visible for Keyboard Navigation */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Link Styles */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}
