/* ===== 기본 스타일 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

/* ===== 컨테이너 ===== */
.bot-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ===== 페이지 헤더 ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px 30px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.page-title h1 {
    font-size: 2rem;
    color: #667eea;
    font-weight: 700;
}

.back-link {
    color: #667eea;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s;
}

.back-link:hover {
    background-color: #f0f4ff;
}

/* ===== 카드 섹션 ===== */
.card-section {
    margin-bottom: 30px;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    padding-left: 10px;
}

/* ===== 메뉴 그리드 (index.html용) ===== */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.menu-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

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

.menu-card-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.menu-card-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 10px;
}

.menu-card-description {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
}

/* ===== 시스템 정보 카드 (index.html용) ===== */
.info-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.info-item {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.info-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 8px;
}

.info-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #667eea;
}

/* ===== 스케줄 카드 (bot_info.html용) ===== */
.schedule-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.schedule-field-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.schedule-field {
    display: flex;
    flex-direction: column;
}

.schedule-field label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
}

.schedule-field input {
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

.schedule-field input:focus {
    outline: none;
    border-color: #667eea;
}

.schedule-field-checkbox {
    align-items: center;
}

.schedule-actions {
    display: flex;
    justify-content: flex-end;
}

/* ===== 봇 카드 (bot_info.html용) ===== */
.bot-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.bot-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.bot-card.new-entry {
    border: 2px dashed #667eea;
    background: #f0f4ff;
}

.bot-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #667eea;
}

.bot-header-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.new-bot-toggle {
    font-size: 1rem;
    margin-right: 8px;
    transition: transform 0.3s;
}

.bot-card-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.bot-field-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.bot-field {
    display: flex;
    flex-direction: column;
}

.bot-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 6px;
}

.bot-field input {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.bot-field input:focus {
    outline: none;
    border-color: #667eea;
}

.bot-field input:disabled {
    background-color: #f5f5f5;
    color: #999;
}

.bot-field-checkbox {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    background: #f8f9fa;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    min-width: 120px;
    gap: 12px;
}

.bot-field-radio {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
}

.radio-options {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.radio-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}

.bot-card-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 10px;
}

/* ===== 티커 그룹 (bot_info.html용) ===== */
.ticker-group-header {
    background: white;
    color: #333;
    border: none;
    border-left: 4px solid #667eea;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.ticker-group-header .ticker-symbol {
    color: #333;
    font-weight: 700;
}

.ticker-group-header .ticker-count {
    color: #666;
    font-weight: 500;
}

.ticker-group-header .toggle-icon {
    color: #667eea;
}

.ticker-group-header:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border-left-color: #5568d3;
}

.ticker-group-header.new-bot-header {
    border-left-color: #28a745 !important;
    justify-content: flex-start !important;
}

.ticker-group-header.new-bot-header .ticker-name {
    color: #333 !important;
}

.ticker-group-header.new-bot-header .new-bot-toggle {
    color: #28a745 !important;
}

.ticker-group-header.new-bot-header:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border-left-color: #218838 !important;
}

.new-bot-container {
    margin-bottom: 20px;
}

.add-history-container {
    margin-bottom: 20px;
}

.ticker-group-header.add-history-header {
    border-left-color: #28a745 !important;
    justify-content: flex-start !important;
}

.ticker-group-header.add-history-header .ticker-name {
    color: #333 !important;
}

.ticker-group-header.add-history-header .add-history-toggle {
    color: #28a745 !important;
}

.ticker-group-header.add-history-header:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border-left-color: #218838 !important;
}

.ticker-toggle {
    font-size: 1.2rem;
}

.ticker-name {
    font-size: 1.1rem;
    margin: 0;
    flex-shrink: 0;
}

.ticker-count {
    font-size: 0.9rem;
    opacity: 0.9;
}

.ticker-group-content {
    padding-left: 0;
    margin-bottom: 20px;
}

/* ===== Status 카드 (status.html용) ===== */
.status-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 20px;
}

.status-section {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.status-section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 15px;
    text-align: center;
}

.status-field-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.status-field {
    display: flex;
    flex-direction: column;
}

.status-field label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
}

.status-field .status-display-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: #2d3748;
    padding: 8px 0;
    background: transparent;
}

.status-field input {
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

.status-field input:focus {
    outline: none;
    border-color: #667eea;
}

.status-actions {
    display: flex;
    justify-content: flex-end;
}

/* ===== 텔레그램 카드 (status.html용) ===== */
.telegram-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.telegram-button-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.btn-telegram {
    padding: 15px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-telegram:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* ===== 버튼 스타일 ===== */
.btn-primary {
    padding: 10px 20px;
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    background-color: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-success {
    padding: 10px 20px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-success:hover {
    background-color: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-danger {
    padding: 10px 20px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-danger:hover {
    background-color: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-info {
    padding: 10px 20px;
    background-color: #17a2b8;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-info:hover {
    background-color: #138496;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-warning {
    padding: 10px 20px;
    background-color: #ffc107;
    color: #333;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-warning:hover {
    background-color: #e0a800;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* ===== 토글 스위치 ===== */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
}

input:checked + .slider {
    background-color: #667eea;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* ===== 로딩 오버레이 ===== */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

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

/* ===== 테이블 스타일 (Trade/Status용) ===== */
.styled-table {
    width: 100%;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.styled-table thead tr {
    background: #667eea;
    color: white;
    text-align: left;
    font-weight: 600;
}

.styled-table th,
.styled-table td {
    padding: 15px;
}

.styled-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
}

.styled-table tbody tr:last-child {
    border-bottom: none;
}

.styled-table tbody tr:hover {
    background-color: #f8f9fa;
}

.styled-table input {
    width: 100%;
    padding: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95rem;
}

.styled-table input:focus {
    outline: none;
    border-color: #667eea;
}

.styled-table input:read-only {
    background-color: #f5f5f5;
}

/* ===== 반응형 디자인 ===== */
@media (max-width: 768px) {
    .page-header {
        padding: 14px 20px;
    }

    .menu-grid {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .schedule-field-group {
        grid-template-columns: 1fr;
    }

    .bot-field-group {
        grid-template-columns: 1fr;
    }

    .status-grid {
        grid-template-columns: 1fr;
    }

    .telegram-button-group {
        grid-template-columns: 1fr;
    }

    .radio-options {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .page-header {
        padding: 12px 14px;
    }

    .page-title h1 {
        font-size: 1.3rem;
    }

    .back-link {
        font-size: 0.85rem;
    }

    .section-title {
        font-size: 1rem;
    }

    .schedule-card,
    .bot-card,
    .status-card,
    .telegram-card,
    .info-card,
    .trade-card,
    .history-card,
    .history-add-card {
        padding: 15px;
    }
}

/* ===== Trade 페이지 스타일 ===== */

/* Trade 티커 그룹 헤더 - 중복 정의 제거됨, 위의 공통 스타일 사용 */

.ticker-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.ticker-symbol {
    font-size: 1.1rem;
    font-weight: 700;
    color: #667eea;
    margin: 0;
}

.ticker-count {
    font-size: 0.9rem;
    color: #888;
    background: rgba(102, 126, 234, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
    margin-left: 0;
}

.toggle-icon {
    font-size: 1.2rem;
    color: #667eea;
    transition: transform 0.3s;
    margin: 0;
    flex-shrink: 0;
}

.ticker-group-content {
    padding-left: 0;
    margin-bottom: 20px;
}

/* Trade Card */
.trade-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s;
}

.trade-card:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    border-color: rgba(102, 126, 234, 0.2);
}

.trade-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.trade-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: #667eea;
}

.trade-symbol {
    font-size: 1rem;
    font-weight: 600;
    color: #888;
    background: #f0f4ff;
    padding: 5px 12px;
    border-radius: 8px;
}

.trade-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.trade-section {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 15px;
}

.trade-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 12px;
}

.trade-field-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.trade-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.trade-field label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #666;
}

.trade-field input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.trade-field input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.trade-field input[readonly] {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.trade-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* History Add Card */
.history-add-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.history-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.history-field label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #666;
}

.history-field input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.history-field input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.history-actions {
    display: flex;
    justify-content: flex-end;
}

/* History Filter Form */
.history-filter-form {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.filter-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    align-items: end;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-field label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #666;
}

.filter-field input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.filter-field input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-actions {
    display: flex;
    align-items: flex-end;
}

/* History List */
.history-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.history-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s;
}

.history-card:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    border-color: rgba(102, 126, 234, 0.2);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.history-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #667eea;
}

.history-symbol {
    font-size: 0.9rem;
    font-weight: 600;
    color: #888;
    background: #f0f4ff;
    padding: 3px 10px;
    border-radius: 6px;
}

.history-type {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    background: #48bb78;
    padding: 3px 10px;
    border-radius: 6px;
}

.history-content {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.history-content .history-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.history-content .history-field label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #999;
}

.history-content .history-field span {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
}

.profit-positive {
    color: #48bb78;
}

.profit-negative {
    color: #f56565;
}

.no-data {
    background: white;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    color: #999;
    font-size: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 모바일 반응형 (Trade 페이지) */
@media (max-width: 768px) {
    .trade-grid,
    .history-grid,
    .filter-group {
        grid-template-columns: 1fr;
    }

    .history-list {
        grid-template-columns: 1fr;
    }

    .trade-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}
