/* Global Tailwind Styles */
@tailwind base;
@tailwind components;
@tailwind utilities;

/* Custom Base Styles */
@layer base {
    * {
        @apply border-gray-200 dark:border-gray-700;
    }

    body {
        @apply font-sans antialiased;
    }

    h1 {
        @apply text-3xl font-bold tracking-tight;
    }

    h2 {
        @apply text-2xl font-semibold tracking-tight;
    }

    h3 {
        @apply text-xl font-semibold;
    }

    h4 {
        @apply text-lg font-semibold;
    }

    h5 {
        @apply text-base font-semibold;
    }

    h6 {
        @apply text-sm font-semibold;
    }
}

/* Custom Components */
@layer components {
    /* Card Component */
    .card {
        @apply bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700;
    }

    .card-header {
        @apply px-6 py-4 border-b border-gray-200 dark:border-gray-700;
    }

    .card-body {
        @apply p-6;
    }

    .card-footer {
        @apply px-6 py-4 border-t border-gray-200 dark:border-gray-700;
    }

    /* Badge Component */
    .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 dark:bg-green-900/30 dark:text-green-400;
    }

    .badge-danger {
        @apply bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400;
    }

    .badge-warning {
        @apply bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400;
    }

    .badge-info {
        @apply bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400;
    }

    .badge-secondary {
        @apply bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300;
    }

    /* Form Label */
    .form-label {
        @apply block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1;
    }

    /* Form Input */
    .form-input {
        @apply w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm
               bg-white dark:bg-gray-700 text-gray-900 dark:text-white
               focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500
               disabled:bg-gray-100 dark:disabled:bg-gray-800 disabled:cursor-not-allowed;
    }

    /* Button Base */
    .btn {
        @apply inline-flex items-center justify-center px-4 py-2 border font-medium rounded-md
               focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors duration-200
               disabled:opacity-50 disabled:cursor-not-allowed;
    }

    .btn-sm {
        @apply px-3 py-1.5 text-sm;
    }

    .btn-lg {
        @apply px-6 py-3 text-lg;
    }

    /* Button Variants */
    .btn-primary {
        @apply bg-blue-600 text-white border-transparent hover:bg-blue-700
               focus:ring-blue-500 dark:bg-blue-500 dark:hover:bg-blue-600;
    }

    .btn-secondary {
        @apply bg-gray-600 text-white border-transparent hover:bg-gray-700
               focus:ring-gray-500;
    }

    .btn-success {
        @apply bg-green-600 text-white border-transparent hover:bg-green-700
               focus:ring-green-500;
    }

    .btn-danger {
        @apply bg-red-600 text-white border-transparent hover:bg-red-700
               focus:ring-red-500;
    }

    .btn-warning {
        @apply bg-yellow-500 text-white border-transparent hover:bg-yellow-600
               focus:ring-yellow-500;
    }

    .btn-info {
        @apply bg-cyan-600 text-white border-transparent hover:bg-cyan-700
               focus:ring-cyan-500;
    }

    .btn-outline {
        @apply bg-transparent border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300
               hover:bg-gray-50 dark:hover:bg-gray-800 focus:ring-gray-500;
    }

    .btn-outline-primary {
        @apply bg-transparent border-blue-600 text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/20
               focus:ring-blue-500;
    }

    .btn-outline-danger {
        @apply bg-transparent border-red-600 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20
               focus:ring-red-500;
    }

    /* Alert Component */
    .alert {
        @apply p-4 rounded-md border;
    }

    .alert-success {
        @apply bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800 text-green-800 dark:text-green-200;
    }

    .alert-danger {
        @apply bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800 text-red-800 dark:text-red-200;
    }

    .alert-warning {
        @apply bg-yellow-50 dark:bg-yellow-900/20 border-yellow-200 dark:border-yellow-800 text-yellow-800 dark:text-yellow-200;
    }

    .alert-info {
        @apply bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800 text-blue-800 dark:text-blue-200;
    }

    /* Table */
    .table {
        @apply min-w-full divide-y divide-gray-200 dark:divide-gray-700;
    }

    .table thead {
        @apply bg-gray-50 dark:bg-gray-800;
    }

    .table th {
        @apply px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider;
    }

    .table tbody {
        @apply bg-white dark:bg-gray-900 divide-y divide-gray-200 dark:divide-gray-700;
    }

    .table td {
        @apply px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100;
    }

    /* Spinner */
    .spinner {
        @apply animate-spin rounded-full border-b-2 border-blue-600;
    }

    /* Text Utilities */
    .text-muted {
        @apply text-gray-500 dark:text-gray-400;
    }

    /* Link */
    .link {
        @apply text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 hover:underline;
    }
}

/* Custom Utilities */
@layer utilities {
    .text-balance {
        text-wrap: balance;
    }

    .transition-all {
        transition-property: all;
        transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
        transition-duration: 150ms;
    }
}

/* Syncfusion Overrides for Tailwind */
.e-grid {
    @apply border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden;
}

.e-grid .e-headercell {
    @apply bg-gray-50 dark:bg-gray-800 font-semibold;
}

.e-grid .e-rowcell {
    @apply border-gray-200 dark:border-gray-700;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    @apply w-2 h-2;
}

::-webkit-scrollbar-track {
    @apply bg-gray-100 dark:bg-gray-800;
}

::-webkit-scrollbar-thumb {
    @apply bg-gray-300 dark:bg-gray-600 rounded-full;
}

::-webkit-scrollbar-thumb:hover {
    @apply bg-gray-400 dark:bg-gray-500;
}

/* Shared sizing for authentication logos */
.auth-logo {
    max-height: 96px;
    width: auto;
    object-fit: contain;
}

@media (max-width: 640px) {
    .auth-logo {
        max-height: 72px;
    }
}

/* Authentication theme (reusable across login workflow) */
.auth-hero {
    min-height: 100vh;
    background: radial-gradient(circle at 15% 20%, rgba(14, 165, 233, 0.12), transparent 22%),
                radial-gradient(circle at 80% 0%, rgba(59, 130, 246, 0.16), transparent 25%),
                linear-gradient(135deg, #0b2a60 0%, #0a1f47 55%, #0d2c4b 100%);
    color: #f8fafc;
}

.auth-card {
    width: min(520px, calc(100% - 2.5rem));
    max-width: 520px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.auth-card h1,
.auth-card h2,
.auth-card h3,
.auth-card p,
.auth-card label,
.auth-card span {
    color: #eaf2ff;
}

/* Syncfusion primary button branding (auth workflow) */
.e-btn.e-primary {
    background-color: #0b2a60 !important;
    border-color: #0b2a60 !important;
}

.e-btn.e-primary:hover,
.e-btn.e-primary:focus,
.e-btn.e-primary:active {
    background-color: #0D2C4B !important;
    border-color: #0D2C4B !important;
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #ffffff;
}

.auth-subtitle {
    color: #d3def9;
    font-size: 1rem;
}

.auth-divider {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2rem 0 0.5rem;
    gap: 0.75rem;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
}

.auth-divider span {
    color: #d3def9;
    font-size: 0.9rem;
}

.auth-social {
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
    background: rgba(255, 255, 255, 0.08);
    transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.auth-social:hover {
    border-color: #0d2c4b !important;
    background: #0d2c4b !important;
    box-shadow: 0 10px 30px rgba(13, 44, 75, 0.4);
    transform: translateY(-1px);
}

.auth-social img {
    filter: brightness(1.2);
}

.auth-checkbox .e-label {
    color: #eaf2ff !important;
}

.auth-link {
    color: #8cc6ff;
}

.auth-link:hover {
    color: #cde5ff;
}
