/* ═══════════════════════════════════════════════
   shared.css — 공통 UI
   ═══════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════
   투자주 추천 탭
   ═══════════════════════════════════════════════ */

.recommendations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 20px;
}

.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--text-muted);
    gap: 12px;
}

.empty-icon {
    width: 48px;
    height: 48px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 1rem;
    color: var(--text-secondary);
}

.empty-state span {
    font-size: 0.85rem;
}

/* 추천 종목 카드 */
.rec-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all 0.3s ease;
    animation: fadeIn 0.4s ease;
}

.rec-card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
}

.rec-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.rec-stock-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rec-stock-badge {
    padding: 6px 12px;
    background: var(--gradient-subtle);
    border: 1px solid rgba(0, 240, 255, 0.15);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--accent-cyan);
}

.rec-stock-name {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.rec-stock-date {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.rec-delete-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.rec-delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

.rec-delete-btn svg {
    width: 16px;
    height: 16px;
}

/* 추천 이유 목록 */
.rec-reasons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rec-reasons-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.reason-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.reason-number {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(124, 58, 237, 0.15);
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent-purple);
    flex-shrink: 0;
}

.reason-input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.83rem;
    outline: none;
    transition: all 0.2s;
}

.reason-input:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}

.reason-input::placeholder {
    color: var(--text-muted);
}

.add-reason-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px;
    background: transparent;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 4px;
}

.add-reason-btn:hover {
    border-color: var(--accent-purple);
    color: var(--accent-purple);
    background: rgba(124, 58, 237, 0.05);
}

.add-reason-btn svg {
    width: 16px;
    height: 16px;
}

.reason-count {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: 4px;
}

.rec-save-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    background: rgba(124, 58, 237, 0.15);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: var(--radius-sm);
    color: var(--accent-purple);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 12px;
}

.rec-save-btn:hover {
    background: rgba(124, 58, 237, 0.25);
}

.rec-save-btn svg {
    width: 16px;
    height: 16px;
}
/* ═══════════════════════════════════════════════
   관리자 탭
   ═══════════════════════════════════════════════ */

.admin-add-user {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 24px;
}

.admin-pill-btn {
    border-radius: 20px !important;
    padding: 6px 16px !important;
    font-size: 0.78rem !important;
    gap: 5px !important;
    background: rgba(16, 185, 129, 0.15) !important;
    border: 1px solid rgba(16, 185, 129, 0.35) !important;
    color: #10b981 !important;
    transition: all 0.2s ease;
}

.admin-pill-btn:hover {
    background: rgba(16, 185, 129, 0.25) !important;
    border-color: rgba(16, 185, 129, 0.5) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.admin-add-user h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.form-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.form-row input,
.form-row select {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-row input:focus,
.form-row select:focus {
    border-color: var(--accent-cyan);
}

.form-row select {
    cursor: pointer;
}

.form-row select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.form-row input {
    flex: 1;
    min-width: 130px;
}

/* 사용자 테이블 */
.users-table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th {
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.02);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.users-table td {
    padding: 12px 20px;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border-color);
}

.users-table tr:last-child td {
    border-bottom: none;
}

.users-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.role-badge.admin {
    background: rgba(0, 240, 255, 0.12);
    color: var(--accent-cyan);
}

.role-badge.user {
    background: rgba(124, 58, 237, 0.12);
    color: var(--accent-purple);
}

.table-actions {
    display: flex;
    gap: 6px;
}

.table-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
}

.table-btn.edit {
    color: var(--accent-amber);
}

.table-btn.edit:hover {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
}

.table-btn.delete {
    color: var(--accent-red);
}

.table-btn.delete:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

/* ???????????????????????????????????????????????????
   추천 확인 모달
   ??????????????????????????????????????????????????? */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 560px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: cardEntry 0.3s ease-out;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-rec-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    transition: border-color 0.2s;
}

.modal-rec-card:hover {
    border-color: rgba(0, 240, 255, 0.15);
}

.modal-rec-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.modal-rec-name {
    font-weight: 500;
    font-size: 0.92rem;
    color: var(--text-primary);
}

.modal-rec-date {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.modal-rec-reasons {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-reason {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
}

.modal-reason.empty {
    color: var(--text-muted);
    font-style: italic;
}

.reason-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: rgba(0, 240, 255, 0.1);
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent-cyan);
    flex-shrink: 0;
}

.table-btn.view {
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.3);
    color: var(--accent-purple);
}

.table-btn.view:hover {
    background: rgba(124, 58, 237, 0.2);
}

/* ???????????????????????????????????????????????????
   사용자 관리 ? 로그인 상태 표시
   ??????????????????????????????????????????????????? */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.3s;
}

.status-dot.online {
    background: var(--accent-green);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.status-dot.offline {
    background: #4a5568;
}

/* ???????????????????????????????????????????????????
   개발자 정보 버튼 & 모달
   ??????????????????????????????????????????????????? */
.dev-info-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 6px 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.25s;
}

.dev-info-btn:hover {
    color: var(--accent-cyan);
    border-color: rgba(0, 240, 255, 0.3);
    background: rgba(0, 240, 255, 0.05);
}

/* 모달 오버레이 */
.dev-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    animation: fadeIn 0.25s ease;
}

/* 모달 카드 */
.dev-modal {
    position: relative;
    width: 380px;
    max-width: 90vw;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 32px 28px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 240, 255, 0.08);
    animation: modalSlideIn 0.35s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dev-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.dev-modal-close:hover {
    color: var(--text-primary);
}

/* 아바타 */
.dev-modal-avatar {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 700;
    color: #0a0e17;
    box-shadow: 0 4px 20px rgba(0, 240, 255, 0.3);
}

.dev-modal-name {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 4px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dev-modal-role {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 3px 12px;
    border-radius: 12px;
    margin-bottom: 20px;
}

/* 상세 정보 */
.dev-modal-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.dev-detail-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.dev-detail-row svg {
    color: var(--accent-cyan);
    flex-shrink: 0;
}

.dev-email {
    color: var(--accent-cyan);
    text-decoration: none;
    transition: color 0.2s;
}

.dev-email:hover {
    color: var(--accent-purple);
    text-decoration: underline;
}

/* 인사말 */
.dev-modal-greeting {
    margin-top: 20px;
    padding: 16px;
    background: var(--gradient-subtle);
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 240, 255, 0.1);
}

.greeting-emoji {
    font-size: 1.4rem;
    display: block;
    margin-bottom: 4px;
}

.dev-modal-greeting p {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    font-style: italic;
    color: var(--text-primary);
}

.dev-modal-footer {
    margin-top: 16px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ???????????????????????????????????????????????????
   투자 정보 공유 탭
   ??????????????????????????????????????????????????? */
.tab-description {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-top: 4px;
}

.shared-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.shared-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.shared-section-header .action-btn.add-btn {
    padding: 5px 14px;
    font-size: 0.72rem;
    gap: 5px;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #10b981;
    transition: all 0.2s ease;
}

.shared-section-header .action-btn.add-btn:hover {
    background: rgba(16, 185, 129, 0.25);
    border-color: rgba(16, 185, 129, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.shared-section-header .action-btn.add-btn svg {
    width: 12px;
    height: 12px;
}

.shared-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.shared-section-title svg {
    color: var(--accent-cyan);
}

.shared-add-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    padding: 14px 16px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.shared-input {
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
    min-width: 120px;
    flex: 1;
}

.shared-input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.1);
}

.shared-input-wide {
    flex: 2;
    min-width: 200px;
}

.shared-table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 400px;
    -webkit-overflow-scrolling: touch;
}

.shared-table {
    width: 100%;
    border-collapse: collapse;
}

.shared-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.82rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
}

.shared-table td {
    padding: 12px 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
}

.shared-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* 드래그 앤 드롭 핸들 */
.drag-handle-cell {
    width: 28px;
    padding: 8px 4px 8px 12px !important;
}

.drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 1.1rem;
    opacity: 0.4;
    transition: opacity 0.2s, color 0.2s;
    user-select: none;
}

.shared-table tr:hover .drag-handle {
    opacity: 1;
    color: var(--accent-cyan);
}

.drag-handle:active {
    cursor: grabbing;
}

/* SortableJS 상태 */
.sortable-ghost {
    background: rgba(0, 240, 255, 0.08) !important;
    border: 1px dashed rgba(0, 240, 255, 0.4);
}

.sortable-ghost td {
    opacity: 0.4;
}

.sortable-chosen td {
    background: rgba(124, 58, 237, 0.08);
}

.sortable-drag {
    background: var(--bg-card) !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), 0 0 15px rgba(0, 240, 255, 0.15);
    border-radius: 4px;
}

.shared-sector-badge {
    display: inline-block;
    padding: 3px 10px;
    background: var(--gradient-subtle);
    border: 1px solid rgba(0, 240, 255, 0.15);
    border-radius: 12px;
    font-size: 0.8rem;
    color: var(--accent-cyan);
    font-weight: 500;
}

.shared-date {
    white-space: nowrap;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.shared-reason {
    max-width: 300px;
    word-break: break-word;
}

.shared-empty {
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Phone 모드 공유 탭 */
body.mode-phone .shared-section {
    padding: 16px;
    margin-bottom: 16px;
}

body.mode-phone .shared-add-form {
    flex-direction: column;
}

body.mode-phone .shared-input {
    width: 100%;
    min-width: auto;
}

body.mode-phone .shared-input-wide {
    flex: auto;
}

body.mode-phone .shared-table {
    min-width: 500px;
}

@media (max-width: 768px) {
    .shared-section {
        padding: 16px;
        margin-bottom: 16px;
    }

    .shared-add-form {
        flex-direction: column;
    }

    .shared-input {
        width: 100%;
        min-width: auto;
    }

    .shared-table {
        min-width: 500px;
    }
}

