/* Custom Rich UI Styles for Crypto Portfolio Management */

:root {
    /* Enhanced Color Palette */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --warning-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    --danger-gradient: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    --info-gradient: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    
    /* Shadows */
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 20px rgba(0, 0, 0, 0.15);
    --shadow-heavy: 0 8px 30px rgba(0, 0, 0, 0.2);
    
    /* Borders */
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
}

/* Global Enhancements */
body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

/* Enhanced Cards */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    background: rgba(255, 255, 255, 0.95);
}

.card-header {
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
    padding: 1.5rem 1.25rem;
    font-weight: 600;
    font-size: 1.1rem;
}

/* Enhanced Navigation */
.navbar {
    box-shadow: var(--shadow-medium);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--primary-color) !important;
}

.nav-link {
    color: var(--gray-600) !important;
    font-weight: 500;
}

.nav-link:hover {
    color: var(--primary-color) !important;
}

.navbar-toggler {
    border-color: #212529;
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2833, 37, 41, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.dropdown-menu {
    border: none;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-medium);
    padding: 0.5rem 0;
}

.dropdown-item {
    padding: 0.75rem 1.5rem;
    border-radius: 0;
    color: #212529;
}

.dropdown-item:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #212529;
}

/* Enhanced List Groups */
.list-group {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-light);
}

.list-group-item {
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1rem 1.5rem;
    position: relative;
}

.list-group-item:last-child {
    border-bottom: none;
}

.list-group-item:hover {
    background: rgba(102, 126, 234, 0.1);
    color: inherit;
}

.list-group-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--primary-gradient);
    opacity: 0;
}

.list-group-item:hover::before {
    opacity: 1;
}

/* Section Headers */
h5.mb-1.py-3 {
    font-weight: 700;
    color: #2c3e50;
    position: relative;
    padding-left: 1rem;
    margin-bottom: 1.5rem !important;
}

h5.mb-1.py-3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 4px;
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 2px;
    transform: translateY(-50%);
}

/* Enhanced Buttons */
.btn {
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--primary-gradient);
    box-shadow: var(--shadow-light);
}

.btn-success {
    background: var(--success-gradient);
    box-shadow: var(--shadow-light);
}

.btn-warning {
    background: var(--warning-gradient);
    box-shadow: var(--shadow-light);
}

.btn-danger {
    background: var(--danger-gradient);
    box-shadow: var(--shadow-light);
}

.btn-info {
    background: var(--info-gradient);
    box-shadow: var(--shadow-light);
}

/* Enhanced Forms */
.form-control {
    border-radius: var(--border-radius-sm);
    border: 2px solid #e1e5e9;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.9);
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.form-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.75rem;
}

/* Enhanced Tables */
.table {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-light);
    background: rgba(255, 255, 255, 0.95);
}

.table thead th {
    background: var(--primary-gradient);
    color: white;
    font-weight: 600;
    border: none;
    padding: 1rem;
    text-align: center;
}

.table tbody tr:hover {
    background: rgba(102, 126, 234, 0.1);
}

.table tbody td {
    padding: 1rem;
    border-color: rgba(0, 0, 0, 0.05);
    vertical-align: middle;
}

/* Crypto-specific Enhancements */
.crypto-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-medium);
    position: relative;
    overflow: hidden;
}

.crypto-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    transform: rotate(45deg);
}

.crypto-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.crypto-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Profit/Loss Indicators */
.profit-positive {
    color: #28a745;
    font-weight: 600;
}

.profit-negative {
    color: #dc3545;
    font-weight: 600;
}

.profit-neutral {
    color: #6c757d;
    font-weight: 600;
}

/* Loading State (no animation) */
.loading {
    opacity: 0.6;
}


/* Enhanced Badges */
.badge {
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    font-size: 0.8rem;
}

/* Status Indicators */
.status-success {
    background: var(--success-gradient);
    color: white;
}

.status-warning {
    background: var(--warning-gradient);
    color: white;
}

.status-danger {
    background: var(--danger-gradient);
    color: white;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-light);
}

/* Enhanced Table Mobile Responsiveness */
@media (max-width: 991px) {
    .table-responsive {
        border-radius: var(--border-radius);
        border: 1px solid var(--gray-200);
    }
    
    .table {
        margin-bottom: 0;
        font-size: 0.875rem;
    }
    
    .table thead th {
        font-size: 0.8rem;
        padding: 0.75rem 0.5rem;
        white-space: nowrap;
    }
    
    .table tbody td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }
    
    /* Hide less important columns on mobile */
    .table .d-none-mobile {
        display: none !important;
    }
    
    /* Stack card content on mobile */
    .card-body .row.g-3 > div {
        margin-bottom: 1rem;
    }
}

/* Mobile Navigation Improvements */
@media (max-width: 768px) {
    .navbar-nav .dropdown-menu {
        border: none;
        box-shadow: none;
        background: transparent;
        padding: 0;
        margin-top: 0.5rem;
    }
    
    .navbar-nav .dropdown-item {
        padding: 1rem 1.5rem;
        border-radius: 8px;
        margin: 0.25rem 0;
        background: rgba(255, 255, 255, 0.95);
        border: 1px solid var(--gray-200);
        font-size: 0.9rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .navbar-nav .dropdown-item:hover {
        background: rgba(102, 126, 234, 0.1);
        border-color: var(--primary-color);
        transform: translateY(-1px);
    }
    
    .navbar-toggler {
        border: none;
        padding: 0.5rem;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.1);
    }
    
    .navbar-toggler:focus {
        box-shadow: none;
    }
    
    .navbar-brand {
        font-size: 1.3rem;
    }
    
    /* ナビゲーション折りたたみの改善 */
    .navbar-collapse {
        margin-top: 1rem;
        padding: 1rem;
        background: rgba(255, 255, 255, 0.98);
        border-radius: 12px;
        border: 1px solid var(--gray-200);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    }
    
    .navbar-nav .nav-item {
        margin: 0.25rem 0;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem !important;
        border-radius: 8px;
        min-height: 44px;
        display: flex;
        align-items: center;
        background: rgba(248, 249, 250, 0.5);
        margin: 0.25rem 0;
        border: 1px solid transparent;
    }
    
    .navbar-nav .nav-link:hover {
        background: rgba(102, 126, 234, 0.1);
        border-color: var(--primary-color);
        transform: translateY(-1px);
    }
}

/* Mobile Card and Layout Optimizations */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .card-header {
        padding: 1rem;
        font-size: 1rem;
    }
    
    .list-group-item {
        padding: 0.75rem 1rem;
    }
    
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Quick action cards mobile optimization */
    .quick-action-card .card-body {
        padding: 1.5rem 1rem !important;
    }
    
    .quick-action-card .rounded-circle {
        width: 50px !important;
        height: 50px !important;
    }
    
    .quick-action-card .fs-4 {
        font-size: 1.2rem !important;
    }
    
    /* Portfolio summary responsive */
    .col-md-3 {
        margin-bottom: 1rem;
    }
    
    /* Button sizes for touch */
    .btn {
        min-height: 44px;
        padding: 0.75rem 1.5rem;
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 0.5rem 1rem;
    }
}

/* Extra small devices (phones, less than 576px) */
@media (max-width: 575px) {
    .table {
        font-size: 0.75rem;
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.5rem 0.25rem;
    }
    
    .card-header h5 {
        font-size: 0.9rem;
    }
    
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    /* Stack all columns on very small screens */
    .col-md-3,
    .col-sm-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Reduce margins and padding */
    main {
        padding: 1rem 0;
    }
    
    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Font size adjustments */
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    /* Touch-friendly form controls */
    .form-control {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Improve dropdown spacing */
    .dropdown-item {
        padding: 1rem 1.25rem;
        font-size: 0.9rem;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.3);
        --shadow-medium: 0 4px 20px rgba(0, 0, 0, 0.4);
        --shadow-heavy: 0 8px 30px rgba(0, 0, 0, 0.5);
    }
    
    body {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
        color: #e0e6ed;
    }
    
    .card {
        background: rgba(42, 54, 71, 0.95);
        color: #e0e6ed;
    }
    
    .table {
        background: rgba(42, 54, 71, 0.95);
        color: #e0e6ed;
    }
    
    .form-control {
        background: rgba(42, 54, 71, 0.9);
        border-color: #4a5568;
        color: #e0e6ed;
    }
}

/* Smooth scrolling disabled for performance */

/* Focus Indicators */
*:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Enhanced Button Styles */
.btn {
    position: relative;
    overflow: hidden;
}

/* Ripple effect removed for performance */

/* Enhanced Form Validation */
.form-control.is-valid {
    border-color: #198754;
    box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.25);
}

.form-control.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Table Search Styling */
.table-search .input-group-text {
    background: var(--primary-gradient);
    color: white;
    border: none;
}

/* Dark Mode Styles */
.dark-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%) !important;
    color: #e0e6ed !important;
}

.dark-mode .card {
    background: rgba(42, 54, 71, 0.95) !important;
    color: #e0e6ed !important;
}

.dark-mode .navbar {
    background: #343a40 !important;
}

.dark-mode .navbar-brand,
.dark-mode .nav-link {
    color: #f8f9fa !important;
}

.dark-mode .nav-link:hover {
    color: white !important;
}

.dark-mode .navbar-toggler {
    border-color: #f8f9fa;
}

.dark-mode .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28248, 249, 250, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.dark-mode .table {
    background: rgba(42, 54, 71, 0.95) !important;
    color: #e0e6ed !important;
}

.dark-mode .form-control {
    background: rgba(42, 54, 71, 0.9) !important;
    border-color: #4a5568 !important;
    color: #e0e6ed !important;
}

.dark-mode .dropdown-menu {
    background: rgba(42, 54, 71, 0.95) !important;
    border-color: #4a5568 !important;
}

.dark-mode .dropdown-item {
    color: #e0e6ed !important;
}

.dark-mode .dropdown-item:hover {
    background: var(--primary-gradient) !important;
    color: white !important;
}

.dark-mode .list-group-item {
    background: rgba(42, 54, 71, 0.9) !important;
    border-color: #4a5568 !important;
    color: #e0e6ed !important;
}

.dark-mode .list-group-item:hover {
    background: rgba(102, 126, 234, 0.15) !important;
    color: #e0e6ed !important;
}

/* Status Indicators Enhancement */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
}

.status-indicator.online {
    background: var(--success-gradient);
    color: white;
}

.status-indicator.offline {
    background: var(--danger-gradient);
    color: white;
}

.status-indicator.pending {
    background: var(--warning-gradient);
    color: white;
}

/* Responsive Grid for Mobile */
@media (max-width: 576px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .card-header {
        padding: 1rem;
        font-size: 1rem;
    }
    
    .list-group-item {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
    }
}

/* Loading States */
.loading-state {
    position: relative;
    pointer-events: none;
}

.loading-state::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-state::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #667eea;
    border-top: 2px solid transparent;
    border-radius: 50%;
    z-index: 1001;
}

/* Locked Account Styles */
.locked-account {
    background: #fafafa;
    border: 1px solid #dee2e6;
    opacity: 0.9;
    position: relative;
    overflow: hidden;
}

.locked-account::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(108, 117, 125, 0.02) 0%, rgba(108, 117, 125, 0.05) 100%);
    pointer-events: none;
}

.locked-account .card-body {
    color: #6c757d;
}

.locked-account h5 {
    opacity: 0.65;
}

.locked-account:hover {
    opacity: 0.95;
    box-shadow: 0 0 0 1px #adb5bd;
}

.dark-mode .locked-account {
    background: #2a3647;
    border-color: #495057;
}

.dark-mode .locked-account .card-body {
    color: #adb5bd;
}

/* Locked Account List in Portfolio */
.locked-account-list {
    opacity: 0.85;
    position: relative;
}

.locked-account-list::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(108, 117, 125, 0.03) 0%, rgba(108, 117, 125, 0.06) 100%);
    pointer-events: none;
    border-radius: var(--border-radius);
}

.locked-account-list .list-group-item {
    background: rgba(248, 249, 250, 0.7);
}

.dark-mode .locked-account-list .list-group-item {
    background: rgba(42, 54, 71, 0.7);
}

/* Locked Cryptocurrency Styles */
.locked-crypt {
    background: #fafafa;
    border: 1px solid #dee2e6;
    opacity: 0.9;
    position: relative;
    overflow: hidden;
}

.locked-crypt::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(108, 117, 125, 0.02) 0%, rgba(108, 117, 125, 0.05) 100%);
    pointer-events: none;
}

.locked-crypt .card-body {
    color: #6c757d;
}

.locked-crypt h5 {
    opacity: 0.65;
}

.locked-crypt:hover {
    opacity: 0.95;
    box-shadow: 0 0 0 1px #adb5bd;
}

.dark-mode .locked-crypt {
    background: #2a3647;
    border-color: #495057;
}

.dark-mode .locked-crypt .card-body {
    color: #adb5bd;
}

/* Locked Cryptocurrency Row in Portfolio */
.locked-crypt-row {
    background: rgba(248, 249, 250, 0.7) !important;
    opacity: 0.85;
}

.locked-crypt-row:hover {
    background: rgba(248, 249, 250, 0.9) !important;
}

.dark-mode .locked-crypt-row {
    background: rgba(42, 54, 71, 0.7) !important;
}

.dark-mode .locked-crypt-row:hover {
    background: rgba(42, 54, 71, 0.9) !important;
}

/* Portfolio Amount Edit Styles */
.amount-input {
    width: 100%;
    text-align: right;
    background: #fff;
    border: 2px solid #007bff;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
}

.amount-input:focus {
    border-color: #0056b3;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

.dark-mode .amount-input {
    background: #2a3647;
    border-color: #007bff;
    color: #e0e6ed;
}

/* Portfolio Account2 Specific Styles */
.sticky-top .list-group-item {
    border-radius: 0;
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    line-height: 1.2;
}

.sticky-top .list-group-item:first-child {
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
}

.sticky-top .list-group-item:last-child {
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

.sticky-top .list-group-item small {
    font-size: 0.8rem;
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 100px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    background: white;
    border-left: 4px solid #667eea;
    z-index: 1050;
}

.notification.success {
    border-left-color: #28a745;
}

.notification.error {
    border-left-color: #dc3545;
}

.notification.warning {
    border-left-color: #ffc107;
}

/* Slide animation removed for performance */