/* Base Styles */
@tailwind base;
@tailwind components;
@tailwind utilities;

/* Custom Styles */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
}

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

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

/* Base Styles */
body {
    @apply font-sans text-gray-900 antialiased;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Form Elements */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="tel"],
select,
textarea {
    @apply w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition duration-150 ease-in-out;
}

input[type="checkbox"],
input[type="radio"] {
    @apply h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded;
}

/* Buttons */
.btn {
    @apply inline-flex items-center justify-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transition duration-150 ease-in-out;
}

.btn-secondary {
    @apply bg-white border border-gray-300 text-gray-700 hover:bg-gray-50;
}

.btn-danger {
    @apply bg-red-600 hover:bg-red-700 focus:ring-red-500;
}

.btn-success {
    @apply bg-green-600 hover:bg-green-700 focus:ring-green-500;
}

/* Cards */
.card {
    @apply bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden;
}

.card-header {
    @apply px-6 py-4 border-b border-gray-200 bg-white;
}

.card-body {
    @apply p-6;
}

.card-footer {
    @apply px-6 py-4 bg-gray-50 border-t border-gray-200;
}

/* Alerts */
.alert {
    @apply p-4 mb-4 rounded-md border-l-4 transition-opacity duration-300 ease-in-out;
    animation: fadeIn 0.3s ease-in-out;
    opacity: 1;
}

.alert.fade-out {
    opacity: 0 !important;
}

.alert-success {
    @apply bg-green-50 border-green-500 text-green-700;
}

.alert-danger {
    @apply bg-red-50 border-red-500 text-red-700;
}

.alert-warning {
    @apply bg-yellow-50 border-yellow-500 text-yellow-700;
}

.alert-info {
    @apply bg-blue-50 border-blue-500 text-blue-700;
}

/* Tables */
.table {
    @apply min-w-full divide-y divide-gray-200;
}

.table th {
    @apply px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider;
}

.table td {
    @apply px-6 py-4 whitespace-nowrap text-sm text-gray-900;
}

.table tbody tr {
    @apply hover:bg-gray-50;
}

.table tbody tr:nth-child(odd) {
    @apply bg-white;
}

.table tbody tr:nth-child(even) {
    @apply bg-gray-50;
}

/* Badges */
.badge {
    @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium;
}

.badge-success {
    @apply bg-green-100 text-green-800;
}

.badge-warning {
    @apply bg-yellow-100 text-yellow-800;
}

.badge-danger {
    @apply bg-red-100 text-red-800;
}

.badge-info {
    @apply bg-blue-100 text-blue-800;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    @apply w-2 h-2;
}

::-webkit-scrollbar-track {
    @apply bg-gray-100;
}

::-webkit-scrollbar-thumb {
    @apply bg-gray-400 rounded-full;
}

::-webkit-scrollbar-thumb:hover {
    @apply bg-gray-500;
}

/* Responsive Table Styles */
@media screen and (max-width: 768px) {
    .responsive-table thead {
        display: none;
    }

    .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td {
        display: block;
        width: 100%;
    }

    .responsive-table tr {
        margin-bottom: 1rem;
        border: 1px solid #e2e8f0; /* gray-200 */
        border-radius: 0.5rem; /* rounded-lg */
        overflow: hidden;
        box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); /* shadow-lg */
    }

    .responsive-table td {
        text-align: right;
        padding-left: 50%;
        position: relative;
        border-bottom: 1px solid #edf2f7; /* gray-100 */
    }

    .responsive-table td:last-child {
        border-bottom: 0;
    }

    .responsive-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 50%;
        padding-left: 1rem;
        font-weight: 600; /* font-semibold */
        text-align: left;
        color: #4a5568; /* gray-700 */
    }

    .responsive-table td:first-child {
        border-top-left-radius: 0.5rem;
        border-top-right-radius: 0.5rem;
    }

    .responsive-table td:last-child {
        border-bottom-left-radius: 0.5rem;
        border-bottom-right-radius: 0.5rem;
    }
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
        font-size: 12pt;
    }
    
    .container {
        width: auto;
        max-width: 100%;
        padding: 0;
    }
    
    .card {
        border: none;
        box-shadow: none;
    }
}

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

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

/* Custom Animations */
.animate-bounce {
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(-25%);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

/* Print-specific styles */
@media print {
    body * {
        visibility: hidden;
    }
    
    #printable, #printable * {
        visibility: visible;
    }
    
    #printable {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    
    .no-print {
        display: none !important;
    }
}
