/* ===================================
   インターホン 共通スタイル
   =================================== */

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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", sans-serif;
    font-size: 16px;
    color: #333;
    background: #f0f2f5;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 24px 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.view[hidden] {
    display: none !important;
}

/* ─── ヘッダー ──────────────── */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* ─── WebSocket 接続インジケータ ─── */

.ws-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.ws-indicator.connected {
    background: #22c55e;
    box-shadow: 0 0 4px rgba(34, 197, 94, 0.5);
}

.ws-indicator.disconnected {
    background: #ef4444;
}

/* ─── ボタン ────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    user-select: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #3b82f6;
    color: #fff;
}

.btn-success {
    background: #22c55e;
    color: #fff;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
}

.btn-secondary {
    background: #6b7280;
    color: #fff;
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.25rem;
    border-radius: 12px;
}

/* ─── index.html ────────────── */

.index-page {
    justify-content: center;
    align-items: center;
    text-align: center;
}

.index-page h1 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.description {
    color: #6b7280;
    margin-bottom: 24px;
}

.form-group {
    width: 100%;
    margin-bottom: 16px;
    text-align: left;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.875rem;
    color: #4b5563;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.index-page .btn {
    width: 100%;
}

/* ─── エラーメッセージ ──────── */

.error-message {
    margin-top: 16px;
    padding: 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: 0.875rem;
    text-align: center;
}

/* ─── 玄関端末: グループリスト ─ */

.status-text {
    font-size: 1.125rem;
    color: #6b7280;
    text-align: center;
    margin-bottom: 20px;
}

.group-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.group-list .btn {
    width: 100%;
    padding: 16px;
    font-size: 1.125rem;
}

/* ─── 呼び出し中アニメーション ─ */

.calling-animation {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 160px;
}

.pulse-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.2);
    animation: pulse 1.5s ease-out infinite;
    position: relative;
}

.pulse-ring::before {
    content: '';
    position: absolute;
    inset: 20px;
    border-radius: 50%;
    background: #3b82f6;
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* ─── 玄関端末: 通話中 ──────── */

.media-container {
    margin-bottom: 20px;
    text-align: center;
}

.media-container video {
    width: 100%;
    max-height: 360px;
    border-radius: 12px;
    background: #000;
    object-fit: cover;
}

/* ─── 待受端末: スタンバイ ───── */

.standby-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
}

.clock {
    font-size: 3rem;
    font-weight: 300;
    color: #1f2937;
    font-variant-numeric: tabular-nums;
}

/* ─── 待受端末: フルスクリーン ─ */

.fullscreen-view {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.video-fullscreen {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.video-fullscreen video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.overlay-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    z-index: 101;
}

.overlay-label {
    color: #fff;
    font-size: 1.125rem;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.overlay-buttons {
    display: flex;
    gap: 16px;
}

/* ─── monitor-page: コンテナ幅制限解除 ─ */

.monitor-page {
    max-width: none;
    padding: 0;
}

.monitor-page .header {
    padding: 16px;
}

.monitor-page .standby-screen {
    padding: 24px;
}
