/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f7fa;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navbar */
.navbar {
    background: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    align-items: center;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background 0.3s;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: rgba(255,255,255,0.1);
}

.nav-toggle {
    display: none;
}

.nav-toggle-label {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 40px;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 8px;
    cursor: pointer;
}

.nav-toggle-label span {
    display: block;
    width: 20px;
    height: 2px;
    background: #ffffff;
    margin: 3px 0;
}

/* Main Content */
.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

.section + .section {
    margin-top: 2.5rem;
}

.section h2 {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: #2c3e50;
    margin-top: 2.5rem;
    margin-bottom: 0.75rem;
}

/* Auth Pages */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.auth-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.auth-title {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 2rem;
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

.auth-link {
    text-align: center;
    margin-top: 1rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #666;
    font-size: 0.875rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}

.form-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-width: 600px;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
    transition: background 0.3s;
}

.btn:hover {
    background: #5568d3;
}

.btn-primary {
    background: #667eea;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
}

.btn-logout {
    background: transparent;
    border: 1px solid white;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.1);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

/* Price Card */
.price-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.price-display {
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
    margin-bottom: 25px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.price-display h2 {
    margin: 0 0 15px 0;
    font-size: 1.2em;
    font-weight: 500;
    opacity: 0.95;
    border: none;
    padding: 0;
    color: white;
}

.price-value {
    font-size: 3rem;
    font-weight: bold;
    margin: 1rem 0;
}

.price-updated {
    font-size: 0.85em;
    opacity: 0.85;
    font-weight: 400;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #556170;
    letter-spacing: 0.02em;
    margin-bottom: 0.35rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #667eea;
    margin: 1rem 0;
}

.stat-card small {
    display: block;
    font-size: 0.8rem;
    color: #7a8596;
}

/* Wallet Grid */
.wallet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.wallet-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.wallet-address {
    display: block;
    background: #f5f7fa;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    word-break: break-all;
    margin: 0.5rem 0;
}

.wallet-info {
    margin: 1rem 0;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.wallet-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.wallet-actions form {
    margin: 0;
}

.wallet-actions .btn {
    background: #f3f4f6;
    color: #2c3e50;
    border: 1px solid #d7dce3;
    box-shadow: none;
    padding: 0.45rem 0.9rem;
    margin: 0;
    font-weight: 600;
}

.wallet-actions .btn:hover {
    background: #e9edf2;
    transform: none;
    box-shadow: none;
}

.wallet-actions .btn-secondary {
    background: #eef2f7;
    color: #2c3e50;
}

.wallet-actions .btn-danger {
    background: #fff;
    color: #c0392b;
    border-color: #f0b2b2;
    box-shadow: none;
}

.wallet-actions .btn-danger:hover {
    background: #fdecec;
    box-shadow: none;
    transform: none;
}

/* Alerts Grid */
.alerts-grid {
    display: grid;
    gap: 1.5rem;
}

.alert-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-left: 4px solid #667eea;
}

.alert-card.disabled {
    opacity: 0.6;
    border-left-color: #ccc;
}

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.alert-thresholds {
    display: flex;
    gap: 2rem;
    margin: 1rem 0;
}

.threshold {
    display: flex;
    flex-direction: column;
}

.threshold-label {
    font-size: 0.875rem;
    color: #666;
}

.threshold-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2c3e50;
}

.alert-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.badge-success {
    background: #e7f6ed;
    color: #1f7a39;
    border-color: #bfe7cc;
}

.badge-secondary {
    background: #f1f3f5;
    color: #5f6b7a;
    border-color: #d6dbe2;
}

.badge-danger {
    background: #fdecec;
    color: #b12a2a;
    border-color: #f3b6b6;
}

.badge-info {
    background: #e8f2ff;
    color: #1d4e89;
    border-color: #c2dafb;
}

.notification-list {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.notification-item {
    background: white;
    border-radius: 10px;
    border: 1px solid #e6e9ef;
    padding: 1rem 1.25rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid #eef1f5;
}

.notification-date {
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 600;
}

.notification-message {
    font-size: 1rem;
    color: #2c3e50;
    margin-bottom: 0.75rem;
}

.notification-details {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    color: #586174;
    font-size: 0.9rem;
}

.alert-actions form {
    margin: 0;
}

.alert-actions .btn {
    background: #f3f4f6;
    color: #2c3e50;
    border: 1px solid #d7dce3;
    box-shadow: none;
    padding: 0.45rem 0.9rem;
    margin: 0;
    font-weight: 600;
}

.alert-actions .btn:hover {
    background: #e9edf2;
    transform: none;
    box-shadow: none;
}

.alert-actions .btn-secondary {
    background: #eef2f7;
    color: #2c3e50;
}

.alert-actions .btn-danger {
    background: #fff;
    color: #c0392b;
    border-color: #f0b2b2;
    box-shadow: none;
}

.alert-actions .btn-danger:hover {
    background: #fdecec;
    box-shadow: none;
    transform: none;
}

.page-header .btn,
.empty-state .btn,
.form-actions .btn {
    background: #f3f4f6;
    color: #2c3e50;
    border: 1px solid #d7dce3;
    box-shadow: none;
}

.page-header .btn:hover,
.empty-state .btn:hover,
.form-actions .btn:hover {
    background: #e9edf2;
    transform: none;
    box-shadow: none;
}

.form-actions .btn-secondary {
    background: #eef2f7;
    color: #2c3e50;
}
/* Position Cards - Dashboard */
.position-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.position-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.position-card.in-range {
    border-color: #28a745;
    background: linear-gradient(to bottom, #f8fff9 0%, white 100%);
}

.position-card.out-of-range {
    border-color: #ffc107;
    background: linear-gradient(to bottom, #fffbf0 0%, white 100%);
}

.position-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f5f5f5;
}

.badge-fee {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    margin-left: 10px;
    font-weight: 600;
}

.badge-range {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.badge-range.in {
    background: #28a745;
    color: white;
}

.badge-range.out {
    background: #ffc107;
    color: #333;
}

.position-amounts {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
}

.position-amounts > div:first-child {
    text-align: center;
    font-size: 0.8rem;
    color: #6b7280;
    letter-spacing: 0.02em;
    font-weight: 600;
    margin-bottom: 10px;
}

.amount-display {
    font-size: 1.1em;
    font-weight: 600;
    color: #2c3e50;
    margin: 6px 0;
}

.token-symbol {
    color: #667eea;
    font-weight: 700;
}

.price-range-section {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(to right, #f8f9fa, #e9ecef);
    border-radius: 10px;
}

.position-grid {
    margin-top: 1rem;
}

.price-range-title {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.price-range-values {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 15px;
}

.price-bound {
    flex: 1;
    text-align: center;
}

.price-label {
    font-size: 0.8em;
    color: #888;
    margin-bottom: 6px;
    font-weight: 500;
}

.price-value {
    font-size: 1.3em;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 6px;
}

.price-diff {
    font-size: 0.85em;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
}

.price-diff.positive {
    color: #ffffff;
    background: #1874e2;
}

.price-diff.negative {
    color: #ffffff;
    background: #e5533d;
}

.price-separator {
    font-size: 1.5em;
    color: #667eea;
    font-weight: 700;
}

/* ポジションフッター */
.position-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    text-align: right;
    font-size: 0.85em;
    color: #999;
    font-weight: 500;
}

/* ボタン */
.btn {
    display: inline-block;
    padding: 12px 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    margin: 5px;
    transition: all 0.3s ease;
    font-weight: 600;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #f56565 0%, #c53030 100%);
    box-shadow: 0 4px 8px rgba(245, 101, 101, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 6px 12px rgba(245, 101, 101, 0.4);
}

.btn-success {
    background: #28a745;
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.btn-success:hover {
    box-shadow: 0 6px 12px rgba(40, 167, 69, 0.4);
}

.section .btn {
    display: block;
    width: fit-content;
    margin: 1rem auto 0;
}

/* フォーム */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* テーブル */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

table th,
table td {
    padding: 14px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.5px;
}

table tr:hover {
    background: #f9f9f9;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .container {
        padding: 0 14px;
    }

    .main-content {
        padding: 1rem;
    }

    .logo {
        font-size: 1.2rem;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .header nav {
        margin-top: 15px;
    }

    .header nav a {
        margin: 0 10px;
    }

    .price-value {
        font-size: 2.5em;
    }

    .position-card {
        padding: 18px;
    }

    .position-grid {
        grid-template-columns: 1fr !important;
        gap: 14px;
    }

    .price-range-values {
        flex-direction: row;
        gap: 10px;
    }

    .price-range-values .price-label {
        font-size: 0.72em;
    }

    .price-range-values .price-value {
        font-size: 1.3em;
    }

    .price-range-values .price-diff {
        font-size: 1em;
        padding: 3px 6px;
    }

    .price-separator {
        transform: none;
    }

    .navbar .container {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 0.75rem;
    }

    .nav-toggle-label {
        display: flex;
        justify-self: end;
    }
    
    .nav-menu {
        display: none;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
        grid-column: 1 / -1;
        padding-top: 0.5rem;
    }

    .nav-toggle:checked + .nav-toggle-label + .nav-menu {
        display: flex;
    }

    .nav-menu li,
    .nav-menu a {
        width: 100%;
        text-align: center;
    }

    .btn-logout {
        width: 100%;
        text-align: center;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .dashboard-stats {
        grid-template-columns: repeat(1, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .dashboard-stats .price-card {
        grid-column: 1 / -1;
    }

    .dashboard-stats .stat-card:not(.price-card) {
        padding: 0.9rem 0.6rem;
    }

    .dashboard-stats .stat-card:not(.price-card) h3 {
        font-size: 0.75rem;
    }

    .dashboard-stats .stat-card:not(.price-card) .stat-value {
        font-size: 1.3rem;
        margin: 0.5rem 0 0;
    }

    .stat-value {
        font-size: 2rem;
        margin: 0.75rem 0;
    }

    .section h2 {
        font-size: 1.15rem;
    }
    
    .wallet-grid {
        grid-template-columns: 1fr;
    }
    
    .alert-thresholds {
        flex-direction: column;
        gap: 1rem;
    }

    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table th,
    table td {
        padding: 10px;
        white-space: nowrap;
    }

    .btn-sm {
        padding: 0.4rem 1rem;
        font-size: 0.875rem;
    }

}
