/**
 * AGEEMCTI Component Library
 * Standardized UI components for consistent styling across the application
 * 
 * Brand Colors:
 * - Navy: #0A192F (primary)
 * - Navy Light: #112240
 * - Navy Dark: #061224
 * - Gold: #C9A84C (accent)
 * - Gold Light: #D4B76A
 * - Gold Dark: #A68A3D
 */

/* ============================================
   SVG ICON NORMALIZATION
   Prevents icons from appearing huge when Tailwind CDN fails
   ============================================ */

svg:not([width]):not([height]) {
    width: 1em;
    height: 1em;
    max-width: 100%;
    flex-shrink: 0;
}

/* ============================================
   BUTTONS
   ============================================ */

/* Primary Button - Navy with gold hover */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    background-color: #0A192F;
    color: #ffffff;
    font-weight: 600;
    border-radius: 0.5rem;
    border: 2px solid #0A192F;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.btn-primary:hover {
    background-color: #112240;
    border-color: #112240;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-primary:focus {
    outline: none;
    ring: 2px;
    ring-color: #C9A84C;
    ring-offset: 2px;
}

.btn-primary:disabled,
.btn-primary.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Secondary Button - Outline */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    background-color: transparent;
    color: #0A192F;
    font-weight: 600;
    border-radius: 0.5rem;
    border: 2px solid #0A192F;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.btn-secondary:hover {
    background-color: #0A192F;
    color: #ffffff;
}

/* Success Button */
.btn-success {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    background-color: #10B981;
    color: #ffffff;
    font-weight: 600;
    border-radius: 0.5rem;
    border: 2px solid #10B981;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.btn-success:hover {
    background-color: #059669;
    border-color: #059669;
}

/* Danger Button */
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    background-color: #EF4444;
    color: #ffffff;
    font-weight: 600;
    border-radius: 0.5rem;
    border: 2px solid #EF4444;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.btn-danger:hover {
    background-color: #DC2626;
    border-color: #DC2626;
}

/* Info Button */
.btn-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    background-color: #3B82F6;
    color: #ffffff;
    font-weight: 600;
    border-radius: 0.5rem;
    border: 2px solid #3B82F6;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.btn-info:hover {
    background-color: #2563EB;
    border-color: #2563EB;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px -2px rgba(37, 99, 235, 0.3);
}

.btn-info:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px -1px rgba(37, 99, 235, 0.2);
}

/* Warning Button */
.btn-warning {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    background-color: #F59E0B;
    color: #ffffff;
    font-weight: 600;
    border-radius: 0.5rem;
    border: 2px solid #F59E0B;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.btn-warning:hover {
    background-color: #D97706;
    border-color: #D97706;
}

/* Outline variants */
.btn-outline-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    background-color: transparent;
    color: #0A192F;
    font-weight: 600;
    border-radius: 0.5rem;
    border: 2px solid #0A192F;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.btn-outline-primary:hover {
    background-color: #0A192F;
    color: #ffffff;
}

.btn-outline-success {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    background-color: transparent;
    color: #10B981;
    font-weight: 600;
    border-radius: 0.5rem;
    border: 2px solid #10B981;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.btn-outline-success:hover {
    background-color: #10B981;
    color: #ffffff;
}

.btn-outline-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    background-color: transparent;
    color: #EF4444;
    font-weight: 600;
    border-radius: 0.5rem;
    border: 2px solid #EF4444;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.btn-outline-danger:hover {
    background-color: #EF4444;
    color: #ffffff;
}

/* Button sizes */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* Button with icon */
.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-icon i {
    font-size: 0.875em;
}

/* ============================================
   CARDS
   ============================================ */

.card {
    background-color: #ffffff;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: box-shadow 0.2s ease-in-out;
}

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

.card-header {
    padding: 1rem 1.5rem;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    color: #0A192F;
}

.card-header.bg-navy {
    background-color: #0A192F;
    color: #ffffff;
    border-bottom: 2px solid #C9A84C;
}

.card-header.bg-success {
    background-color: #10B981;
    color: #ffffff;
}

.card-header.bg-danger {
    background-color: #EF4444;
    color: #ffffff;
}

.card-header.bg-warning {
    background-color: #F59E0B;
    color: #ffffff;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background-color: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

/* Card with border accent */
.card-border-success {
    border: 2px solid #10B981;
}

.card-border-warning {
    border: 2px solid #F59E0B;
}

.card-border-danger {
    border: 2px solid #EF4444;
}

.card-border-navy {
    border: 2px solid #0A192F;
}

/* ============================================
   BADGES
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success {
    background-color: #D1FAE5;
    color: #065F46;
}

.badge-danger {
    background-color: #FEE2E2;
    color: #991B1B;
}

.badge-warning {
    background-color: #FEF3C7;
    color: #92400E;
}

.badge-info {
    background-color: #DBEAFE;
    color: #1E40AF;
}

.badge-navy {
    background-color: #0A192F;
    color: #C9A84C;
}

.badge-gold {
    background-color: #C9A84C;
    color: #0A192F;
}

.badge-gray {
    background-color: #F3F4F6;
    color: #374151;
}

/* ============================================
   TABLES
   ============================================ */

.table-container {
    overflow-x: auto;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background-color: #ffffff;
}

.table thead {
    background-color: #0A192F;
    color: #ffffff;
}

.table thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.15s ease-in-out;
}

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

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

.table tbody td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #374151;
}

/* Striped table */
.table-striped tbody tr:nth-child(even) {
    background-color: #F9FAFB;
}

.table-striped tbody tr:nth-child(even):hover {
    background-color: #F3F4F6;
}

/* Table with actions */
.table-actions {
    display: flex;
    gap: 0.5rem;
}

.table-actions .btn-sm {
    padding: 0.25rem 0.5rem;
    min-height: auto;
    min-width: auto;
    height: auto;
    width: auto;
}

.table-actions .btn-sm i {
    display: inline-block;
    margin: 0;
    font-size: 0.875rem;
}

/* Keep actions understandable even when the external icon font is blocked. */
.table-actions .action-label {
    display: inline;
    margin-left: 0.3rem;
}

/* ============================================
   FORMS
   ============================================ */

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
}

.form-label.required::after {
    content: " *";
    color: #EF4444;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #111827;
    background-color: #ffffff;
    border: 1px solid #D1D5DB;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    outline: none;
    border-color: #C9A84C;
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.2);
}

.form-control:disabled,
.form-control[readonly] {
    background-color: #F3F4F6;
    opacity: 1;
}

.form-control.is-invalid {
    border-color: #EF4444;
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.form-control.is-valid {
    border-color: #10B981;
}

.form-control.is-valid:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.form-error {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #EF4444;
}

.form-error i {
    margin-right: 0.25rem;
}

.form-help {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #6B7280;
}

/* Select */
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Textarea */
textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Checkbox and Radio */
.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.form-check-input {
    width: 1rem;
    height: 1rem;
    margin-right: 0.5rem;
    border: 1px solid #D1D5DB;
    border-radius: 0.25rem;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: #0A192F;
    border-color: #0A192F;
}

.form-check-label {
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
}

/* Form row (horizontal layout) */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* ============================================
   ALERTS
   ============================================ */

.alert {
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert i {
    margin-top: 0.125rem;
    flex-shrink: 0;
}

.alert-success {
    background-color: #D1FAE5;
    border: 1px solid #A7F3D0;
    color: #065F46;
}

.alert-danger {
    background-color: #FEE2E2;
    border: 1px solid #FECACA;
    color: #991B1B;
}

.alert-warning {
    background-color: #FEF3C7;
    border: 1px solid #FDE68A;
    color: #92400E;
}

.alert-info {
    background-color: #DBEAFE;
    border: 1px solid #BFDBFE;
    color: #1E40AF;
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-state-icon {
    font-size: 4rem;
    color: #D1D5DB;
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.5rem;
}

.empty-state-description {
    color: #6B7280;
    margin-bottom: 1.5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
    margin-top: 1.5rem;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    min-width: 2.5rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease-in-out;
}

.pagination a {
    background-color: #ffffff;
    border: 1px solid #D1D5DB;
    color: #374151;
}

.pagination a:hover {
    background-color: #F3F4F6;
    border-color: #9CA3AF;
}

.pagination .active span {
    background-color: #0A192F;
    border-color: #0A192F;
    color: #ffffff;
}

.pagination .disabled span {
    background-color: #F3F4F6;
    border-color: #E5E7EB;
    color: #9CA3AF;
    cursor: not-allowed;
}
