/* mobile.css - Styles specifically for mobile devices */

/* General mobile optimizations */
body {
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    -webkit-touch-callout: none;
    overflow-x: hidden;
}

/* Mobile-first approach */
@media (max-width: 767.98px) {
    .container {
        padding-left: 16px;
        padding-right: 16px;
        max-width: 100%;
    }
    
    .row {
        margin-left: -10px;
        margin-right: -10px;
    }
    
    .col, [class*="col-"] {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Card design for mobile */
    .card {
        margin-bottom: 20px;
        border-radius: 16px;
        overflow: hidden;
    }
    
    .card-header {
        padding: 16px 20px;
        font-size: 1.1rem;
    }
    
    .card-body {
        padding: 20px;
    }
    
    .card-footer {
        padding: 16px 20px;
    }
    
    /* Button optimizations for touch */
    .btn {
        padding: 12px 16px;
        font-size: 0.95rem;
        border-radius: 10px;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 500;
    }
    
    /* Bottom navigation bar */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: var(--surface-dark);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
        padding: 8px 0;
        z-index: 1000;
        display: flex;
        justify-content: space-around;
    }
    
    .mobile-nav-item {
        text-align: center;
        padding: 8px 0;
    }
    
    .mobile-nav-item i {
        font-size: 1.5rem;
        color: var(--text-secondary);
        display: block;
        margin-bottom: 4px;
    }
    
    .mobile-nav-item.active i {
        color: #505050;
    }
    
    .mobile-nav-item span {
        font-size: 0.75rem;
        color: var(--text-secondary);
    }
    
    .mobile-nav-item.active span {
        color: #505050;
    }
    
    /* Main content area adjustments for bottom nav */
    main {
        margin-bottom: 70px;
        padding-bottom: 20px;
    }
    
    /* Mobile headers */
    h1, .h1 {
        font-size: 1.75rem;
        margin-bottom: 1rem;
    }
    
    h2, .h2 {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }
    
    h3, .h3 {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
    }
    
    /* Tables on mobile */
    .table-responsive {
        margin-bottom: 1.5rem;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: var(--box-shadow);
    }
    
    .table {
        margin-bottom: 0;
    }
    
    /* Card-based table alternative for small screens */
    .mobile-data-cards .card {
        margin-bottom: 16px;
    }
    
    .mobile-data-cards .card-header {
        padding: 12px 16px;
        font-size: 1rem;
    }
    
    .mobile-data-cards .card-body {
        padding: 16px;
    }
    
    .mobile-data-row {
        display: flex;
        margin-bottom: 8px;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 8px;
    }
    
    .mobile-data-row:last-child {
        margin-bottom: 0;
        border-bottom: none;
        padding-bottom: 0;
    }
    
    .mobile-data-label {
        flex: 0 0 40%;
        font-weight: 500;
        color: var(--text-secondary);
    }
    
    .mobile-data-value {
        flex: 0 0 60%;
        text-align: right;
        color: var(--text-primary);
    }
}

/* Touch effect for mobile interactions */
.mobile-touch-active {
    opacity: 0.75;
    transform: scale(0.98);
    transition: opacity 0.1s, transform 0.1s;
}

/* Fix form elements on mobile */
input, select, textarea {
    font-size: 16px !important; /* Prevents zooming on iOS */
}

@media (max-width: 767.98px) {
    /* Form elements optimization */
    .form-control, .custom-select {
        height: 48px;
        padding: 10px 16px;
        font-size: 16px;
        border-radius: 10px;
        background-color: var(--input-bg);
    }
    
    .form-label {
        font-weight: 500;
        margin-bottom: 8px;
        font-size: 0.95rem;
    }
    
    textarea.form-control {
        height: auto;
        min-height: 100px;
    }
    
    .form-check {
        padding-left: 2rem;
    }
    
    .form-check-input {
        margin-left: -2rem;
        margin-top: 0.2rem;
        width: 1.25rem;
        height: 1.25rem;
    }
    
    /* Form group spacing */
    .form-group, .mb-3 {
        margin-bottom: 20px;
    }
    
    /* Full-width buttons on mobile */
    .btn-mobile-full {
        display: block;
        width: 100%;
    }
    
    /* Action buttons row */
    .mobile-actions {
        display: flex;
        gap: 10px;
        margin-top: 24px;
    }
    
    .mobile-actions .btn {
        flex: 1;
    }
    
    /* Mobile-friendly alerts */
    .alert {
        border-radius: 12px;
        padding: 16px;
        margin-bottom: 20px;
    }
    
    /* Add gray focus state */
    .form-control:focus, .custom-select:focus {
        border-color: #505050;
        box-shadow: 0 0 0 0.25rem rgba(80, 80, 80, 0.25);
    }
    
    /* Override alert-primary with gray colors */
    .alert-primary {
        background-color: rgba(80, 80, 80, 0.15);
        border-color: rgba(80, 80, 80, 0.4);
        color: #707070;
    }
}

/* Override any remaining notification dots or indicators */
.badge-primary,
.notification-dot,
.status-indicator.active,
.online-indicator {
    background-color: #505050 !important;
}

/* Override text colors */
.text-primary {
    color: #505050 !important;
}

/* Override borders */
.border-primary {
    border-color: #505050 !important;
}

/* Update any active state colors */
.active, 
.nav-link.active, 
.page-item.active .page-link,
.step.active,
.tab.active {
    color: #505050 !important;
}

/* Override primary button colors */
.btn-primary {
    background-color: #505050 !important;
    border-color: #505050 !important;
    color: #212121 !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: #707070 !important;
    border-color: #707070 !important;
}

.btn-outline-primary {
    color: #505050 !important;
    border-color: #505050 !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: rgba(80, 80, 80, 0.15) !important;
    color: #707070 !important;
}

/* Improved modal experience on mobile */
@media (max-width: 767.98px) {
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-content {
        border-radius: 16px;
        border: none;
        background-color: var(--surface-dark);
    }
    
    .modal-header {
        padding: 16px 20px;
        border-bottom-color: var(--border-color);
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 16px 20px;
        border-top-color: var(--border-color);
    }
    
    .modal-title {
        font-size: 1.25rem;
        font-weight: 600;
    }
    
    .close {
        color: var(--text-primary);
        opacity: 0.8;
        text-shadow: none;
    }
    
    .close:hover {
        color: var(--primary);
        opacity: 1;
    }
}

/* Pull-to-refresh animation */
.pull-to-refresh {
    height: 60px;
    text-align: center;
    position: absolute;
    top: -60px;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.pull-to-refresh i {
    font-size: 1.5rem;
    animation: spin 1.5s infinite linear;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Animation effects */
@media (max-width: 767.98px) {
    .fade-in-up {
        animation: fadeInUp 0.4s ease forwards;
    }
    
    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .fade-in {
        animation: fadeIn 0.4s ease forwards;
    }
    
    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Make sure buttons stack properly on mobile */
.btn-group {
    display: flex;
    flex-wrap: wrap;
}

.btn-group > .btn {
    flex: 1 0 auto;
    margin-bottom: 5px;
}

/* Improve navbar on mobile */
@media (max-width: 767.98px) {
    .navbar-collapse {
        max-height: 80vh;
        overflow-y: auto;
    }
    
    .navbar-nav .nav-item {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .navbar-nav .nav-item:last-child {
        border-bottom: none;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
    }
}

/* Responsive text breaks */
.text-break-responsive {
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

/* Override form control height on mobile */
@media (max-width: 767.98px) {
    .form-control, .custom-select {
        height: 44px;
    }
    
    textarea.form-control {
        height: auto;
    }
    
    /* Fix iOS form elements */
    input[type="date"],
    input[type="time"],
    input[type="datetime-local"],
    input[type="month"] {
        -webkit-appearance: none;
    }
}

/* Make sure dropdowns are usable on touch devices */
.dropdown-menu {
    max-height: 80vh;
    overflow-y: auto;
}

.dropdown-item {
    min-height: 44px;
    display: flex;
    align-items: center;
}

/* Improve scrolling on iOS */
html, body {
    -webkit-overflow-scrolling: touch;
}

/* Specific improvements for the account creation and management pages */
@media (max-width: 767.98px) {
    .account-details {
        font-size: 0.95rem;
    }
    
    .account-detail-value {
        word-break: break-word;
    }
}

/* Make sure alerts are properly visible on mobile */
.alert {
    word-wrap: break-word;
    max-width: 100%;
}

/* Improve form validation messages on mobile */
.text-danger {
    word-wrap: break-word;
    display: block;
    margin-top: 5px;
}

/* Enhanced page transitions and loading effects */
.card, .btn, .alert {
    transition: all 0.3s ease;
}

.btn {
    position: relative;
    overflow: hidden;
}

.btn:active::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    animation: btnRipple 0.4s ease-out;
}

@keyframes btnRipple {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    90% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0.3;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Loading indicators inside buttons */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading .spinner-border {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.btn-loading .btn-text {
    visibility: hidden;
}

/* Various loading animations */
.loading-pulse {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 20px;
}

.loading-pulse div {
    position: absolute;
    top: 8px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #007bff;
    animation-timing-function: cubic-bezier(0, 1, 1, 0);
}

.loading-pulse div:nth-child(1) {
    left: 8px;
    animation: loading-pulse1 0.6s infinite;
}

.loading-pulse div:nth-child(2) {
    left: 8px;
    animation: loading-pulse2 0.6s infinite;
}

.loading-pulse div:nth-child(3) {
    left: 32px;
    animation: loading-pulse2 0.6s infinite;
}

.loading-pulse div:nth-child(4) {
    left: 56px;
    animation: loading-pulse3 0.6s infinite;
}

@keyframes loading-pulse1 {
    0% {
        transform: scale(0);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes loading-pulse3 {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(0);
    }
}

@keyframes loading-pulse2 {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(24px, 0);
    }
}

/* Additional page transition effects for elements */
@media (max-width: 767.98px) {
    .container > .row > [class*="col-"] {
        opacity: 0;
        animation: staggerFadeIn 0.6s ease forwards;
    }
    
    .container > .row > [class*="col-"]:nth-child(1) {
        animation-delay: 0.1s;
    }
    
    .container > .row > [class*="col-"]:nth-child(2) {
        animation-delay: 0.2s;
    }
    
    .container > .row > [class*="col-"]:nth-child(3) {
        animation-delay: 0.3s;
    }
    
    .container > .row > [class*="col-"]:nth-child(4) {
        animation-delay: 0.4s;
    }
    
    @keyframes staggerFadeIn {
        from {
            opacity: 0;
            transform: translateY(15px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    h1, h2, h3, .page-title {
        opacity: 0;
        animation: slideFromRight 0.5s ease forwards;
    }
    
    @keyframes slideFromRight {
        from {
            opacity: 0;
            transform: translateX(20px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
}

/* Optimize transitions for low-power mode */
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Custom checkboxes and radio buttons for mobile */
@media (max-width: 767.98px) {
    /* Custom checkbox styling */
    .custom-checkbox {
        position: relative;
        padding-left: 35px;
        cursor: pointer;
        user-select: none;
        display: inline-block;
        margin-bottom: 15px;
        min-height: 25px;
        display: flex;
        align-items: center;
    }

    .custom-checkbox input {
        position: absolute;
        opacity: 0;
        cursor: pointer;
        height: 0;
        width: 0;
    }

    .checkmark {
        position: absolute;
        left: 0;
        top: 0;
        height: 25px;
        width: 25px;
        background-color: var(--input-bg);
        border: 1px solid var(--border-color);
        border-radius: 5px;
        transition: all 0.2s ease;
    }

    .custom-checkbox:hover input ~ .checkmark {
        background-color: #333333;
    }

    .custom-checkbox input:checked ~ .checkmark {
        background-color: var(--primary);
        border-color: var(--primary);
    }

    .checkmark:after {
        content: "";
        position: absolute;
        display: none;
    }

    .custom-checkbox input:checked ~ .checkmark:after {
        display: block;
    }

    .custom-checkbox .checkmark:after {
        left: 9px;
        top: 5px;
        width: 6px;
        height: 11px;
        border: solid white;
        border-width: 0 2px 2px 0;
        transform: rotate(45deg);
    }

    /* Custom radio button styling */
    .custom-radio {
        position: relative;
        padding-left: 35px;
        cursor: pointer;
        user-select: none;
        display: inline-block;
        margin-bottom: 15px;
        min-height: 25px;
        display: flex;
        align-items: center;
    }

    .custom-radio input {
        position: absolute;
        opacity: 0;
        cursor: pointer;
        height: 0;
        width: 0;
    }

    .radio-mark {
        position: absolute;
        left: 0;
        top: 0;
        height: 25px;
        width: 25px;
        background-color: var(--input-bg);
        border: 1px solid var(--border-color);
        border-radius: 50%;
        transition: all 0.2s ease;
    }

    .custom-radio:hover input ~ .radio-mark {
        background-color: #333333;
    }

    .custom-radio input:checked ~ .radio-mark {
        background-color: var(--primary);
        border-color: var(--primary);
    }

    .radio-mark:after {
        content: "";
        position: absolute;
        display: none;
    }

    .custom-radio input:checked ~ .radio-mark:after {
        display: block;
    }

    .custom-radio .radio-mark:after {
        left: 9px;
        top: 9px;
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: white;
    }

    /* Switch toggle */
    .switch-container {
        position: relative;
        display: inline-block;
        width: 60px;
        height: 34px;
    }

    .switch-container input {
        opacity: 0;
        width: 0;
        height: 0;
    }

    .slider {
        position: absolute;
        cursor: pointer;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: var(--input-bg);
        transition: .4s;
        border-radius: 34px;
        border: 1px solid var(--border-color);
    }

    .slider:before {
        position: absolute;
        content: "";
        height: 26px;
        width: 26px;
        left: 3px;
        bottom: 3px;
        background-color: white;
        transition: .4s;
        border-radius: 50%;
    }

    input:checked + .slider {
        background-color: var(--primary);
        border-color: var(--primary);
    }

    input:focus + .slider {
        box-shadow: 0 0 1px var(--primary);
    }

    input:checked + .slider:before {
        transform: translateX(26px);
    }

    /* Make form-check more touch-friendly */
    .form-check-input {
        width: 24px;
        height: 24px;
        margin-top: 0;
        cursor: pointer;
    }

    .form-check-label {
        padding-left: 5px;
        cursor: pointer;
    }
}

/* Prevent text selection on mobile for better UX */
.no-select {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.mobile-nav-item.active {
    color: #505050;
}

.mobile-nav-item:hover {
    color: #707070;
} 