/* Custom Dark Theme for Hundi Transfer */

:root {
    --bs-primary: #0d7377;
    --bs-primary-rgb: 13, 115, 119;
    --bs-secondary: #14a085;
    --bs-secondary-rgb: 20, 160, 133;
    --bs-success: #16a085;
    --bs-info: #3498db;
    --bs-warning: #f39c12;
    --bs-danger: #e74c3c;
    --bs-dark: #1a1a1a;
    --bs-body-bg: #121212;
    --bs-body-color: #e9ecef;
    --crypto-gradient: linear-gradient(135deg, #0d7377 0%, #14a085 100%);
}

/* Body and main styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    line-height: 1.6;
    min-height: 100vh;
    min-height: calc(var(--vh, 1vh) * 100);
}

/* Hero section styles */
.hero-section {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    min-height: 70vh;
    display: flex;
    align-items: center;
}

/* Card enhancements */
.card {
    border: 1px solid #343a40;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.4);
}

.card-header {
    border-bottom: 1px solid #495057;
    font-weight: 600;
}

/* Primary gradient card */
.bg-gradient-primary {
    background: var(--crypto-gradient) !important;
}

/* Form controls dark theme - ensure proper sizing */
.form-control {
    background-color: #2d2d2d !important;
    border-color: #495057 !important;
    color: #e9ecef !important;
    padding: 0.375rem 0.75rem !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    width: 100% !important;
    display: block !important;
    min-height: calc(1.5em + 0.75rem + 2px) !important;
}

.form-control:focus {
    background-color: #343a40 !important;
    border-color: var(--bs-primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(13, 115, 119, 0.25) !important;
    color: #e9ecef !important;
}

.form-select {
    background-color: #2d2d2d !important;
    border-color: #495057 !important;
    color: #e9ecef !important;
    padding: 0.375rem 0.75rem !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    width: 100% !important;
    display: block !important;
    min-height: calc(1.5em + 0.75rem + 2px) !important;
}

.form-select:focus {
    background-color: #343a40 !important;
    border-color: var(--bs-primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(13, 115, 119, 0.25) !important;
    color: #e9ecef !important;
}

/* Input group fixes */
.input-group {
    position: relative !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: stretch !important;
    width: 100% !important;
}

.input-group > .form-control {
    position: relative !important;
    flex: 1 1 auto !important;
    width: 1% !important;
    min-width: 0 !important;
}

/* Input group text dark theme */
.input-group-text {
    background-color: #343a40 !important;
    border-color: #495057 !important;
    color: #adb5bd !important;
    padding: 0.375rem 0.75rem !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    display: flex !important;
    align-items: center !important;
    border: 1px solid #495057 !important;
}

/* Button enhancements */
.btn-primary {
    background: var(--crypto-gradient);
    border-color: var(--bs-primary);
    font-weight: 500;
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #0a5d61 0%, #117a65 100%);
    border-color: #0a5d61;
    box-shadow: 0 0 0 0.2rem rgba(13, 115, 119, 0.25);
}

/* Alert customizations */
.alert {
    border: none;
    border-radius: 8px;
    font-weight: 500;
}

.alert-success {
    background-color: rgba(22, 160, 133, 0.15);
    color: #16a085;
    border-left: 4px solid #16a085;
}

.alert-danger {
    background-color: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
    border-left: 4px solid #e74c3c;
}

.alert-warning {
    background-color: rgba(243, 156, 18, 0.15);
    color: #f39c12;
    border-left: 4px solid #f39c12;
}

.alert-info {
    background-color: rgba(52, 152, 219, 0.15);
    color: #3498db;
    border-left: 4px solid #3498db;
}

/* Navbar enhancements */
.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: color 0.2s ease;
}

.navbar-nav .nav-link:hover {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Dropdown menu dark theme */
.dropdown-menu-dark {
    background-color: #2d2d2d;
    border: 1px solid #495057;
}

.dropdown-menu-dark .dropdown-item:hover,
.dropdown-menu-dark .dropdown-item:focus {
    background-color: #343a40;
    color: #e9ecef;
}

/* Badge styles */
.badge {
    font-size: 0.75rem;
    font-weight: 600;
}

/* Table dark theme enhancements */
.table-dark {
    background-color: #1e1e1e;
}

.table-dark th,
.table-dark td {
    border-color: #343a40;
}

.table-hover > tbody > tr:hover {
    background-color: #2d2d2d;
}

/* Progress bars */
.progress {
    background-color: #343a40;
    border-radius: 10px;
    height: 8px;
}

.progress-bar {
    background: var(--crypto-gradient);
    border-radius: 10px;
}

/* Status badges */
.badge.status-pending {
    background-color: #f39c12;
    color: #fff;
}

.badge.status-processing {
    background-color: #3498db;
    color: #fff;
}

.badge.status-completed {
    background-color: #16a085;
    color: #fff;
}

.badge.status-cancelled {
    background-color: #e74c3c;
    color: #fff;
}

.badge.status-failed {
    background-color: #c0392b;
    color: #fff;
}

/* Custom animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 40px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero-section {
        min-height: 60vh;
        padding: 2rem 0;
    }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .lead {
        font-size: 1rem;
    }
    
    /* Mobile container adjustments */
    .container,
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Card adjustments for mobile */
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Form adjustments */
    .col-md-6.col-lg-4 {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Demo credentials card */
    .card.border-info .row > div {
        margin-bottom: 1rem;
    }
    
    /* Button adjustments */
    .btn {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
    
    .btn-lg {
        font-size: 1rem;
        padding: 0.6rem 1.2rem;
    }
    
    /* Table responsive */
    .table-responsive {
        font-size: 0.875rem;
    }
    
    /* Navbar adjustments */
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    /* Mobile Navigation Fixes */
    .navbar-collapse {
        position: relative;
        z-index: 1050;
        background-color: var(--bs-primary);
        margin: 0 -12px;
        padding: 1rem 12px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .navbar-toggler {
        padding: 0.25rem 0.5rem;
        font-size: 1rem;
        z-index: 1051;
    }
    
    .navbar-toggler:focus {
        box-shadow: none;
        outline: 2px solid rgba(255, 255, 255, 0.5);
    }
    
    /* Mobile notification bell */
    .notification-badge-mobile {
        font-size: 0.6rem;
        padding: 0.2rem 0.3rem;
        min-width: 16px;
    }
    
    .mobile-notification-menu {
        width: calc(100vw - 30px) !important;
        max-width: 350px;
        right: 0;
        left: auto !important;
    }
    
    /* Mobile dropdown fixes */
    .dropdown-menu {
        position: absolute !important;
        z-index: 1060 !important;
    }
    
    .navbar-nav .dropdown-menu {
        position: static !important;
        float: none;
        width: 100%;
        margin-top: 0.5rem;
        background-color: rgba(0, 0, 0, 0.2);
        border: none;
        border-radius: 0.5rem;
    }
    
    /* Ensure logout button is clickable */
    #logout-form button {
        background: none;
        border: none;
        cursor: pointer;
        width: 100%;
        text-align: left;
        padding: 0.5rem 1rem;
    }
    
    #logout-form button:hover,
    #logout-form button:focus {
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    /* Footer adjustments */
    footer {
        padding: 1rem 0;
        font-size: 0.75rem;
    }
    
    /* Alert adjustments */
    .alert {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    /* Input group adjustments */
    .input-group-text {
        padding: 0.375rem 0.5rem;
    }
    
    .form-control,
    .form-select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.5rem 0.75rem !important;
        min-height: 44px !important;
    }
    
    /* Modal adjustments */
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-content {
        border-radius: 0.5rem;
    }
    
    /* Badge adjustments */
    .badge {
        font-size: 0.7rem;
    }
    
    /* Stat card adjustments */
    .stat-card {
        margin-bottom: 1rem;
    }
    
    /* Timeline adjustments */
    .timeline {
        padding-left: 1.5rem;
    }
    
    .timeline::before {
        left: 0.75rem;
    }
    
    .timeline-item::before {
        left: -1.25rem;
    }
}

/* Extra small devices (phones, less than 576px) */
@media (max-width: 575.98px) {
    /* Login page specific */
    .col-md-6.col-lg-4 {
        max-width: 100%;
        padding: 0 15px;
    }
    
    /* Card optimizations for mobile */
    .card {
        border-radius: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .card.shadow-lg {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    }
    
    /* Demo credentials mobile layout */
    .card.border-info .row > div[class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
        text-align: center;
        padding: 0.5rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .card.border-info .row > div[class*="col-"]:last-child {
        border-bottom: none;
    }
    
    /* Form label spacing */
    .form-label {
        font-size: 0.9rem;
        margin-bottom: 0.25rem;
    }
    
    /* Main container padding */
    main.container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    main.container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Table container with horizontal scroll */
    .table-responsive {
        margin: 0 -10px;
        padding: 0 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 600px;
    }
    
    /* Navigation mobile enhancements */
    .navbar {
        padding: 0.5rem 1rem;
    }
    
    .navbar-nav {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        border-radius: 0.375rem;
        margin-bottom: 0.25rem;
    }
    
    .navbar-nav .nav-link:hover,
    .navbar-nav .nav-link:focus {
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    /* Better touch targets */
    .dropdown-item {
        padding: 0.75rem 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Mobile-optimized forms */
    .form-control,
    .form-select,
    .btn {
        min-height: 44px !important;
        touch-action: manipulation;
    }
    
    /* Notification dropdown mobile */
    .dropdown-menu[style*="width: 300px"] {
        width: calc(100vw - 30px) !important;
        left: 15px !important;
        right: 15px !important;
    }
    
    /* Modal full width */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100%;
    }
    
    .modal-content {
        height: 100%;
        border-radius: 0;
    }
    
    /* Display classes adjustments */
    .display-1 { font-size: 2.5rem; }
    .display-2 { font-size: 2rem; }
    .display-3 { font-size: 1.75rem; }
    .display-4 { font-size: 1.5rem; }
    .display-5 { font-size: 1.25rem; }
    .display-6 { font-size: 1rem; }
    
    /* Hide certain elements on mobile */
    .d-md-block.d-none {
        display: none !important;
    }
    
    /* Button group mobile */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group > .btn {
        border-radius: 0.25rem !important;
        margin-bottom: 0.5rem;
    }
    
    /* Pagination mobile */
    .pagination {
        font-size: 0.875rem;
    }
    
    .page-link {
        padding: 0.25rem 0.5rem;
    }
}

/* Landscape orientation fixes */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        min-height: 100vh;
    }
    
    .card {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Loading spinner */
.spinner-crypto {
    width: 40px;
    height: 40px;
    border: 4px solid #343a40;
    border-top: 4px solid var(--bs-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Footer enhancements */
footer {
    border-top: 1px solid #343a40;
    margin-top: auto;
}

footer a {
    color: var(--bs-secondary);
    transition: color 0.2s ease;
}

footer a:hover {
    color: #fff;
}

/* Icon enhancements */
.bi {
    vertical-align: -0.125em;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #495057;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6c757d;
}

/* Mobile scrollbar */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }
}

/* Notification styles */
.notification-item {
    border-left: 3px solid var(--bs-primary);
    background-color: rgba(13, 115, 119, 0.1);
    transition: background-color 0.2s ease;
}

.notification-item:hover {
    background-color: rgba(13, 115, 119, 0.2);
}

.notification-item.unread {
    border-left-color: var(--bs-warning);
    background-color: rgba(243, 156, 18, 0.1);
}

/* Dashboard stat cards */
.stat-card {
    background: linear-gradient(135deg, #343a40 0%, #495057 100%);
    border: 1px solid #6c757d;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

/* Form validation */
.is-invalid {
    border-color: #e74c3c;
    box-shadow: 0 0 0 0.2rem rgba(231, 76, 60, 0.25);
}

.is-valid {
    border-color: #16a085;
    box-shadow: 0 0 0 0.2rem rgba(22, 160, 133, 0.25);
}

.invalid-feedback {
    color: #e74c3c;
    font-size: 0.875rem;
}

.valid-feedback {
    color: #16a085;
    font-size: 0.875rem;
}

/* Timeline styles for transfer tracking */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--bs-primary);
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 0.25rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bs-primary);
}

.timeline-item.completed::before {
    background: var(--bs-success);
}

.timeline-item.current::before {
    background: var(--bs-warning);
    box-shadow: 0 0 0 4px rgba(243, 156, 18, 0.3);
}

/* Action button contrast fixes for grid tables */
.table .btn-outline-primary {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
}

.table .btn-outline-primary:hover,
.table .btn-outline-primary:focus {
    background-color: #0a5d61;
    border-color: #0a5d61;
    color: #fff;
    box-shadow: 0 0 0 0.2rem rgba(13, 115, 119, 0.25);
}

.table .btn-outline-danger {
    background-color: var(--bs-danger);
    border-color: var(--bs-danger);
    color: #fff;
}

.table .btn-outline-danger:hover,
.table .btn-outline-danger:focus {
    background-color: #c0392b;
    border-color: #c0392b;
    color: #fff;
    box-shadow: 0 0 0 0.2rem rgba(231, 76, 60, 0.25);
}

.table .btn-outline-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #fff;
}

.table .btn-outline-secondary:hover,
.table .btn-outline-secondary:focus {
    background-color: #5a6268;
    border-color: #545b62;
    color: #fff;
}

.table .btn-outline-info {
    background-color: var(--bs-info);
    border-color: var(--bs-info);
    color: #fff;
}

.table .btn-outline-info:hover,
.table .btn-outline-info:focus {
    background-color: #2980b9;
    border-color: #2980b9;
    color: #fff;
}

/* Mobile touch-friendly adjustments */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .form-control,
    .form-select {
        min-height: 44px;
    }
    
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .dropdown-item {
        padding: 0.75rem 1rem;
    }
    
    /* Remove hover effects on touch devices */
    .card:hover {
        transform: none;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    }
    
    .stat-card:hover {
        transform: none;
        box-shadow: none;
    }
    
    /* Improve tap feedback */
    .btn:active,
    .nav-link:active,
    .dropdown-item:active {
        opacity: 0.8;
        transform: scale(0.98);
    }
}

/* Mobile-first dashboard improvements */
@media (max-width: 767px) {
    /* Dashboard cards stack nicely */
    .row > [class*="col-"] {
        margin-bottom: 1rem;
    }
    
    /* Dashboard stats display */
    .stat-card h3 {
        font-size: 1.5rem;
    }
    
    .stat-card p {
        font-size: 0.9rem;
    }
    
    /* Transfer cards mobile view */
    .transfer-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .transfer-card .badge {
        font-size: 0.75rem;
    }
    
    /* Mobile-friendly tables */
    .table td,
    .table th {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Action buttons in tables */
    .table .btn-sm {
        padding: 0.375rem 0.5rem;
        font-size: 0.8rem;
    }
}

/* Safe area insets for notched devices */
@supports (padding: env(safe-area-inset-left)) {
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    .navbar {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }
    
    footer {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Utility classes for mobile */
@media (max-width: 575.98px) {
    .text-xs-center { text-align: center !important; }
    .text-xs-left { text-align: left !important; }
    .text-xs-right { text-align: right !important; }
    .mt-xs-3 { margin-top: 1rem !important; }
    .mb-xs-3 { margin-bottom: 1rem !important; }
    .p-xs-2 { padding: 0.5rem !important; }
}