/* ═══════════════════════════════════════════════════════════
   🚀 Ultimate Enhancement CSS — 視覚強化
   ═══════════════════════════════════════════════════════════ */

/* ━━━ セキュリティウィジェット(浮遊) ━━━ */
#securityWidget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
    border: 2px solid rgba(0, 255, 136, 0.4);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.15), 0 4px 15px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: widgetPulse 3s ease-in-out infinite;
    font-size: 22px;
}
#securityWidget:hover {
    transform: scale(1.15);
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.3), 0 6px 20px rgba(0,0,0,0.4);
    border-color: rgba(0, 255, 136, 0.8);
}
#securityWidget.expanded {
    width: 300px;
    height: auto;
    border-radius: 16px;
    padding: 16px;
    flex-direction: column;
    align-items: stretch;
    bottom: 20px;
    right: 20px;
}
#securityWidget .widget-content {
    display: none;
    font-size: 12px;
    color: #e0e0e0;
    line-height: 1.6;
}
#securityWidget.expanded .widget-content {
    display: block;
    margin-top: 8px;
}
#securityWidget.expanded .widget-icon {
    font-size: 16px;
    text-align: center;
}
.widget-bar {
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.1);
    margin: 4px 0;
    overflow: hidden;
}
.widget-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s ease;
}
.widget-bar-fill.green { background: linear-gradient(90deg, #00ff88, #00cc66); }
.widget-bar-fill.yellow { background: linear-gradient(90deg, #ffcc00, #ff9900); }
.widget-bar-fill.red { background: linear-gradient(90deg, #ff4444, #cc0000); }
.widget-label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #aaa;
    margin-top: 6px;
}

@keyframes widgetPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(0, 255, 136, 0.15), 0 4px 15px rgba(0,0,0,0.3); }
    50% { box-shadow: 0 0 25px rgba(0, 255, 136, 0.25), 0 4px 15px rgba(0,0,0,0.3); }
}

/* ━━━ サイドバー暗号強度メーター ━━━ */
.crypto-meter {
    margin: 8px 12px;
    padding: 10px 12px;
    background: rgba(0, 255, 136, 0.05);
    border: 1px solid rgba(0, 255, 136, 0.15);
    border-radius: 10px;
    font-size: 11px;
}
.crypto-meter-title {
    color: #00ff88;
    font-weight: 600;
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.meter-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 3px 0;
}
.meter-label {
    flex: 0 0 60px;
    color: #888;
    font-size: 10px;
}
.meter-track {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
}
.meter-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.meter-fill.aes { background: linear-gradient(90deg, #00ff88, #00cc66); width: 100%; }
.meter-fill.ecdh { background: linear-gradient(90deg, #00ccff, #0088ff); width: 85%; }
.meter-fill.rsa { background: linear-gradient(90deg, #ff8800, #ffcc00); width: 60%; }
.meter-fill.pqc { background: linear-gradient(90deg, #ff00ff, #8800ff); width: 45%; }

/* ━━━ グロー効果 ━━━ */
.glow-text {
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5), 0 0 20px rgba(0, 255, 136, 0.3);
}
.glow-border {
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.2), inset 0 0 15px rgba(0, 255, 136, 0.05);
}

/* ━━━ 暗号化プログレスバー ━━━ */
#cryptoProgress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}
#cryptoProgress.active {
    opacity: 1;
}
#cryptoProgress .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #00ff88, #00ccff, #8800ff, #ff00ff);
    background-size: 300% 100%;
    animation: progressShimmer 2s linear infinite;
    border-radius: 0 2px 2px 0;
    transition: width 0.3s;
}
@keyframes progressShimmer {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

/* ━━━ 通知トースト ━━━ */
#toastContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99998;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    background: rgba(15, 25, 35, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 10px;
    padding: 12px 18px;
    color: #e0e0e0;
    font-size: 13px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    pointer-events: auto;
    animation: toastIn 0.4s cubic-bezier(0.4, 0, 0.2, 1), toastOut 0.4s 3.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    max-width: 320px;
}
.toast.warning { border-color: rgba(255, 204, 0, 0.5); }
.toast.error { border-color: rgba(255, 68, 68, 0.5); }
.toast.success { border-color: rgba(0, 255, 136, 0.5); }
@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

/* ━━━ タイピングエフェクト ━━━ */
.typing-effect {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid #00ff88;
    animation: typing 1.5s steps(30, end), blinkCaret 0.75s step-end infinite;
}
@keyframes typing { from { width: 0; } to { width: 100%; } }
@keyframes blinkCaret { from, to { border-color: transparent; } 50% { border-color: #00ff88; } }

/* ━━━ カード光沢効果 ━━━ */
.card-shine {
    position: relative;
    overflow: hidden;
}
.card-shine::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 40%, rgba(255,255,255,0.03) 50%, transparent 60%);
    animation: cardShine 4s ease-in-out infinite;
    pointer-events: none;
}
@keyframes cardShine {
    0%, 100% { transform: translateX(-100%) rotate(45deg); }
    50% { transform: translateX(100%) rotate(45deg); }
}

/* ━━━ ゲーム偽装モード ━━━ */
body.game-disguise {
    --primary: #ff6b35;
    --bg-dark: #1a1a2e;
}
body.game-disguise .sidebar { background: linear-gradient(180deg, #16213e, #0f3460) !important; }
body.game-disguise .nav-item { color: #e9d5a1 !important; }
body.game-disguise h1, body.game-disguise .logo { color: #ff6b35 !important; }

/* ━━━ パーティクル背景 ━━━ */
#particleBg {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -2;
    pointer-events: none;
}

/* ━━━ ステルスチャット暗号化インジケータ ━━━ */
.e2e-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 12px;
    font-size: 10px;
    color: #00ff88;
    animation: e2ePulse 2s ease-in-out infinite;
}
@keyframes e2ePulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* ━━━ レスポンシブ調整 ━━━ */
@media (max-width: 768px) {
    #securityWidget { bottom: 12px; right: 12px; width: 48px; height: 48px; font-size: 18px; }
    #securityWidget.expanded { width: calc(100vw - 24px); }
    #toastContainer { right: 12px; left: 12px; }
    .toast { max-width: 100%; }
    #secStatusBar { font-size: 10px; padding: 4px 8px; }
    #quickFAB { bottom: 80px; right: 12px; }
    .activity-panel { display: none !important; }
}

/* ━━━ セキュリティステータスバー ━━━ */
#secStatusBar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 28px;
    background: linear-gradient(90deg, rgba(10,15,25,0.95), rgba(15,25,40,0.95));
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(0,255,136,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 11px;
    color: #aaa;
    z-index: 100000;
    font-family: 'SF Mono', 'Fira Code', monospace;
    padding: 0 16px;
}
.ssb-item { color: #ccc; white-space: nowrap; }
.ssb-sep { color: #333; font-size: 10px; }
.ssb-clock { color: #00ff88; font-weight: 500; }
body { padding-top: 28px !important; }

/* ━━━ アクティビティログパネル ━━━ */
.activity-panel {
    position: fixed;
    top: 28px;
    right: 0;
    width: 260px;
    height: calc(100vh - 28px);
    background: rgba(10,15,25,0.92);
    backdrop-filter: blur(10px);
    border-left: 1px solid rgba(0,255,136,0.1);
    z-index: 9990;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    overflow-y: auto;
}
.activity-panel.collapsed { transform: translateX(220px); }
.activity-header {
    padding: 12px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #00ff88;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    user-select: none;
}
.activity-header:hover { background: rgba(0,255,136,0.05); }
.activity-list { padding: 4px 0; }
.activity-entry {
    padding: 6px 14px;
    font-size: 11px;
    color: #999;
    border-bottom: 1px solid rgba(255,255,255,0.02);
    animation: activityFadeIn 0.3s ease;
}
.activity-entry.encrypt { border-left: 2px solid #00ff88; }
.activity-entry.decrypt { border-left: 2px solid #00ccff; }
.activity-entry.keygen { border-left: 2px solid #ffcc00; }
.activity-entry.navigate { border-left: 2px solid #8888ff; }
.activity-entry.system { border-left: 2px solid #666; }
.activity-time { color: #555; margin-right: 6px; font-size: 10px; }
@keyframes activityFadeIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: translateX(0); } }

/* ━━━ 暗号化フラッシュエフェクト ━━━ */
.crypto-flash {
    position: fixed;
    inset: 0;
    z-index: 99996;
    pointer-events: none;
    animation: cryptoFlash 0.6s ease-out forwards;
}
.crypto-flash.encrypt { background: radial-gradient(circle at center, rgba(0,255,136,0.12) 0%, transparent 70%); }
.crypto-flash.decrypt { background: radial-gradient(circle at center, rgba(0,204,255,0.12) 0%, transparent 70%); }
@keyframes cryptoFlash { from { opacity: 1; } to { opacity: 0; } }

/* ━━━ テキストエリアカウンタ ━━━ */
.textarea-counter {
    position: absolute;
    bottom: 4px;
    right: 8px;
    font-size: 10px;
    color: #555;
    pointer-events: none;
    font-family: 'SF Mono', monospace;
    background: rgba(0,0,0,0.6);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ━━━ サイドバー クイック情報 ━━━ */
.sidebar-quick-info {
    margin: 8px 12px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    font-size: 11px;
}
.qi-title {
    font-size: 10px;
    color: #00ccff;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.qi-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    color: #777;
    font-size: 10px;
}
.qi-row span:last-child { color: #aaa; font-family: 'SF Mono', monospace; }

/* ━━━ クイックアクションFAB ━━━ */
#quickFAB {
    position: fixed;
    bottom: 90px;
    right: 20px;
    z-index: 9998;
}
.fab-main {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6c5ce7, #a855f7);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(108,92,231,0.4);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.fab-main:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 6px 20px rgba(108,92,231,0.6);
}
#quickFAB.open .fab-main {
    transform: rotate(45deg);
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}
.fab-menu {
    position: absolute;
    bottom: 56px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s;
}
#quickFAB.open .fab-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.fab-item {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(15,25,40,0.95);
    border: 1px solid rgba(255,255,255,0.15);
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.fab-item:hover {
    transform: scale(1.15);
    border-color: rgba(0,255,136,0.5);
    box-shadow: 0 0 15px rgba(0,255,136,0.2);
}

/* ━━━ ライトテーマ ━━━ */
body.light-theme {
    background: #f5f5f5 !important;
    color: #333 !important;
}
body.light-theme .sidebar {
    background: linear-gradient(180deg, #ffffff, #f0f0f0) !important;
    border-right: 1px solid #ddd !important;
}
body.light-theme .sidebar-title,
body.light-theme .nav-label { color: #333 !important; }
body.light-theme .main-content { background: #fafafa !important; }
body.light-theme .card, body.light-theme .cipher-panel {
    background: white !important;
    border-color: #e0e0e0 !important;
    color: #333 !important;
}
body.light-theme textarea, body.light-theme input {
    background: #f8f8f8 !important;
    color: #333 !important;
    border-color: #ddd !important;
}
body.light-theme #secStatusBar {
    background: rgba(255,255,255,0.95) !important;
    border-bottom-color: #e0e0e0 !important;
}
body.light-theme .ssb-item { color: #555 !important; }
body.light-theme .activity-panel {
    background: rgba(255,255,255,0.95) !important;
    border-left-color: #e0e0e0 !important;
}
body.light-theme .activity-entry { color: #555 !important; }
body.light-theme .toast {
    background: rgba(255,255,255,0.95) !important;
    color: #333 !important;
    border-color: #ddd !important;
}
