/* ============================================
   SEED REWARDS SYSTEM STYLES
   Updated: December 2025 - Phase 5 Polish
   ============================================ */

/* ============ GLOBAL STYLES ============ */
:root {
    --seed-primary: #ffc107;
    --seed-success: #28a745;
    --seed-danger: #dc3545;
    --seed-warning: #ff9800;
    --seed-info: #17a2b8;
    --seed-dark: #343a40;
    --seed-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --seed-shadow-hover: 0 8px 12px rgba(0, 0, 0, 0.15);
    --seed-transition: all 0.3s ease;
}

/* Seed Display in Header */
.seeds-display {
    transition: transform 0.2s ease;
    cursor: pointer;
}

.seeds-display:hover {
    transform: scale(1.05);
}

.seeds-display i {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Transaction Type Badges */
.badge-earn {
    background-color: #28a745 !important;
    color: white !important;
}

.badge-spend {
    background-color: #dc3545 !important;
    color: white !important;
}

.badge-transfer-in {
    background-color: #17a2b8 !important;
    color: white !important;
}

.badge-transfer-out {
    background-color: #ffc107 !important;
    color: #000 !important;
}

.badge-expired {
    background-color: #6c757d !important;
    color: white !important;
}

/* Seed Amount Display */
.seed-amount-positive {
    color: #28a745;
    font-weight: bold;
}

.seed-amount-negative {
    color: #dc3545;
    font-weight: bold;
}

/* Analytics Cards */
.analytics-card {
    border-left: 4px solid;
    transition: transform 0.2s ease;
}

.analytics-card:hover {
    transform: translateX(5px);
}

.analytics-card.primary {
    border-left-color: #007bff;
}

.analytics-card.success {
    border-left-color: #28a745;
}

.analytics-card.danger {
    border-left-color: #dc3545;
}

.analytics-card.warning {
    border-left-color: #ffc107;
}

/* Voucher Cards */
.voucher-card {
    border: 2px solid #ffc107;
    border-radius: 10px;
    background: linear-gradient(135deg, #fff9e6 0%, #ffffff 100%);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
}

.voucher-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.voucher-card.insufficient-seeds {
    opacity: 0.6;
    border-color: #ccc;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.voucher-card-header {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #000;
    padding: 15px;
    font-weight: bold;
}

.voucher-card-body {
    padding: 20px;
}

.voucher-code {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.voucher-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
}

/* Transaction Table */
.table tbody tr {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

/* Modal Enhancements */
.modal.show {
    display: block !important;
}

/* Quick Action Buttons */
.btn-outline-primary:hover,
.btn-outline-warning:hover,
.btn-outline-success:hover,
.btn-outline-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Loading States */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* User Search Component */
.user-search-dropdown {
    position: absolute;
    z-index: 1000;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.user-search-item {
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.user-search-item:hover {
    background-color: #f8f9fa;
}

.user-search-item.active {
    background-color: #007bff;
    color: white;
}

/* Confirmation Modal */
.confirmation-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Transfer Summary */
.transfer-summary {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.transfer-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #dee2e6;
}

.transfer-summary-row:last-child {
    border-bottom: none;
    font-weight: bold;
    font-size: 1.1rem;
}

/* Pagination */
.pagination {
    margin-bottom: 0;
}

.page-link {
    cursor: pointer;
    user-select: none;
}

.page-item.disabled .page-link {
    cursor: not-allowed;
}

/* Expiry Warning */
.expiry-warning {
    animation: pulse-warning 2s infinite;
}

@keyframes pulse-warning {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .voucher-card {
        margin-bottom: 15px;
    }

    .seeds-display .d-none.d-sm-inline {
        display: none !important;
    }

    .analytics-card {
        margin-bottom: 15px;
    }

    .table-responsive {
        font-size: 0.875rem;
    }

    .transfer-summary {
        padding: 15px;
    }

    .modal-dialog {
        margin: 10px;
    }
}

@media (max-width: 576px) {
    .analytics-card h3 {
        font-size: 1.5rem;
    }

    .voucher-card-body {
        padding: 15px;
    }

    .table th,
    .table td {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .top-row,
    .btn,
    .pagination {
        display: none !important;
    }

    .card {
        border: 1px solid #000;
        box-shadow: none;
    }
}

/* Accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Tooltips */
[title] {
    cursor: help;
}

/* Success/Error Messages */
.alert-floating {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1060;
    min-width: 300px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Chart Containers */
.chart-container {
    position: relative;
    height: 300px;
    margin: 20px 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-card {
    height: 150px;
}

/* ============ RESPONSIVE DESIGN ============ */

/* Mobile First Approach */
@media (max-width: 576px) {
    /* Header Seeds Display */
    .seeds-display {
        font-size: 0.9rem;
        padding: 0.3rem 0.6rem;
    }

    /* Cards */
    .card {
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* Voucher Cards */
    .voucher-card {
        margin-bottom: 1rem;
    }

    .voucher-card-header {
        padding: 0.75rem;
    }

    .voucher-code {
        font-size: 1rem;
    }

    /* Tables */
    .table-responsive {
        font-size: 0.85rem;
    }

    .table th,
    .table td {
        padding: 0.5rem;
    }

    /* Buttons */
    .btn-group {
        display: flex;
        flex-direction: column;
    }

    .btn-group .btn {
        margin-bottom: 0.25rem;
        width: 100%;
    }

    /* Analytics Cards */
    .analytics-card h3 {
        font-size: 1.5rem;
    }

    .icon-box {
        width: 40px;
        height: 40px;
    }

    .icon-box i {
        font-size: 1.2rem !important;
    }

    /* Modal */
    .modal-dialog {
        margin: 0.5rem;
    }

    /* User Search Dropdown */
    .user-search-dropdown {
        max-height: 200px;
    }

    /* Transfer Summary */
    .transfer-summary-card {
        margin-top: 1rem;
    }
}

/* Tablet */
@media (min-width: 577px) and (max-width: 768px) {
    .voucher-card {
        margin-bottom: 1rem;
    }

    .analytics-card h3 {
        font-size: 1.75rem;
    }

    .table-responsive {
        font-size: 0.9rem;
    }
}

/* Desktop */
@media (min-width: 769px) {
    /* Sticky sidebar for transfer page */
    .transfer-summary-card {
        position: sticky;
        top: 80px;
    }

    /* Hover effects */
    .card:hover {
        box-shadow: var(--seed-shadow-hover);
    }

    /* Table actions */
    .btn-group {
        opacity: 0.7;
    }

    tr:hover .btn-group {
        opacity: 1;
    }
}

/* Print Styles */
@media print {
    .seeds-display,
    .btn,
    .breadcrumb,
    .modal,
    .alert,
    nav {
        display: none !important;
    }

    .card {
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }

    .table {
        font-size: 10pt;
    }
}

/* ============ ACCESSIBILITY ============ */

/* Focus Styles */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid var(--seed-primary);
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .voucher-card {
        border-width: 3px;
    }

    .badge {
        border: 1px solid currentColor;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --seed-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
        --seed-shadow-hover: 0 8px 12px rgba(0, 0, 0, 0.4);
    }

    .card {
        background-color: #2d3748;
        color: #e2e8f0;
    }

    .voucher-card {
        background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    }

    .table {
        color: #e2e8f0;
    }

    .table-light {
        background-color: #4a5568;
        color: #e2e8f0;
    }
}

/* ============ UTILITY CLASSES ============ */

/* Text Utilities */
.text-seed-primary { color: var(--seed-primary) !important; }
.text-seed-success { color: var(--seed-success) !important; }
.text-seed-danger { color: var(--seed-danger) !important; }

/* Background Utilities */
.bg-seed-primary { background-color: var(--seed-primary) !important; }
.bg-seed-success { background-color: var(--seed-success) !important; }
.bg-seed-danger { background-color: var(--seed-danger) !important; }

/* Border Utilities */
.border-seed-primary { border-color: var(--seed-primary) !important; }
.border-seed-success { border-color: var(--seed-success) !important; }
.border-seed-danger { border-color: var(--seed-danger) !important; }

/* Animation Utilities */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Tooltip Enhancement */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem;
    background-color: #343a40;
    color: white;
    border-radius: 4px;
    font-size: 0.875rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Selection */
::selection {
    background-color: var(--seed-primary);
    color: #000;
}
