/* ===================================
   Instagram Custom Viewer - スタイルシート
   =================================== */

:root {
    --primary: #e4405f;
    --primary-dark: #c13584;
    --primary-light: #fd1d1d;
    --secondary: #833ab4;
    --accent: #fcaf45;
    --gradient: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);

    --bg-primary: #0a0a0a;
    --bg-secondary: #121212;
    --bg-tertiary: #1a1a1a;
    --bg-hover: #252525;
    --bg-active: #333333;

    --text-primary: #fafafa;
    --text-secondary: #a8a8a8;
    --text-muted: #737373;

    --glass-bg: rgba(18, 18, 18, 0.9);
    --glass-border: rgba(255, 255, 255, 0.1);

    --sidebar-width: 280px;
    --header-height: 56px;
    --border-radius: 8px;
    --border-radius-lg: 12px;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

a {
    color: var(--primary);
    text-decoration: none;
}

button {
    cursor: pointer;
    border: none;
    font-family: inherit;
    background: transparent;
}

input {
    font-family: inherit;
}

.hidden {
    display: none !important;
}

/* 背景グラデーション */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 300px;
    background: linear-gradient(180deg, rgba(228, 64, 95, 0.1), transparent);
    pointer-events: none;
    z-index: 0;
}

/* グラス効果 */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
}

/* ===================================
   上部ナビゲーション
   =================================== */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.back-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.back-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.back-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
}

.instagram-icon {
    width: 28px;
    height: 28px;
    fill: url(#instagram-gradient);
}

.logo svg {
    fill: var(--primary);
}

/* ===================================
   メインコンテナ
   =================================== */
.main-container {
    display: flex;
    padding-top: var(--header-height);
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* ===================================
   サイドバー
   =================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    overflow-y: auto;
}

.search-container {
    padding: 16px;
    display: flex;
    gap: 8px;
}

.search-container input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.search-container input::placeholder {
    color: var(--text-muted);
}

.search-container input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-fast);
}

.search-icon:hover {
    transform: scale(1.05);
}

.search-icon svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* アカウントリスト */
.account-list {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.account-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 4px;
}

.account-item:hover {
    background: var(--bg-hover);
}

.account-item.active {
    background: var(--bg-active);
}

.account-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--gradient);
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.account-avatar-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    overflow: hidden;
}

.account-avatar-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.account-info {
    flex: 1;
    min-width: 0;
}

.account-username {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-bio {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.delete-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all var(--transition-fast);
}

.account-item:hover .delete-btn {
    opacity: 1;
}

.delete-btn svg {
    width: 16px;
    height: 16px;
    fill: var(--text-secondary);
}

.delete-btn:hover svg {
    fill: var(--primary);
}

/* 追加ボタン */
.add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 16px;
    padding: 12px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: var(--border-radius);
    border: 2px dashed var(--glass-border);
    transition: all var(--transition-fast);
}

.add-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--primary);
}

.add-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* ===================================
   メインコンテンツ
   =================================== */
.content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Welcome画面 */
.welcome-content {
    text-align: center;
    color: var(--text-muted);
}

.welcome-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-icon svg {
    width: 40px;
    height: 40px;
    fill: white;
}

.welcome-content h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.welcome-content p {
    font-size: 1rem;
    max-width: 400px;
}

/* プロフィールビュー */
.profile-view {
    width: 100%;
    max-width: 500px;
}

.profile-card {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 32px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--gradient);
    padding: 3px;
    flex-shrink: 0;
}

.profile-avatar>span,
.profile-avatar>img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 600;
    object-fit: cover;
}

.profile-info h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.profile-info p {
    color: var(--text-secondary);
}

.profile-actions {
    display: flex;
    gap: 12px;
}

.btn-open-instagram {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 24px;
    background: var(--gradient);
    color: white;
    font-weight: 600;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.btn-open-instagram:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(228, 64, 95, 0.4);
}

.btn-open-instagram svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* ===================================
   モーダル
   =================================== */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 420px;
    padding: 32px;
    border-radius: var(--border-radius-lg);
    animation: slideUp 0.3s ease;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: var(--bg-hover);
    border-radius: 50%;
    font-size: 24px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.modal-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    text-align: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* フォーム */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-primary {
    width: 100%;
    padding: 14px 28px;
    background: var(--gradient);
    color: white;
    font-weight: 600;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(228, 64, 95, 0.4);
}

/* ===================================
   トースト
   =================================== */
#toast-container {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    backdrop-filter: blur(20px);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
}

.toast.success {
    border-color: rgba(228, 64, 95, 0.4);
}

.toast.error {
    border-color: rgba(255, 0, 0, 0.4);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* ===================================
   レスポンシブ
   =================================== */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        top: 0;
        max-height: 40vh;
    }

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

    .main-container {
        flex-direction: column;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }
}