/* style.css */

@import url('https://fonts.googleapis.com/icon?family=Material+Icons');

/*────────────────────────────
    Global Base Styles
────────────────────────────*/
body {
    font-family: sans-serif;
    line-height: 1.5;
    position: relative;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
}

body.live-all {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
    background-color: #ffffff;
}

/*────────────────────────────
    Headings & Form Layout
────────────────────────────*/
h1 {
    font-size: 1.4em;
    margin-top: 1em;
    margin-bottom: 0.5em;
    text-align: center;
    width: 100%;
}

h3 {
    font-size: 1.2em;
    margin-top: 1em;
    margin-bottom: 0.5em;
    text-align: center;
    width: 100%;
}


form {
    width: 100%;
    max-width: 400px; /* スマホでも見やすい幅 */
    margin: 10px auto;
    padding-right: 10px;
    padding-left: 10px;
    text-align: center;
    box-sizing: border-box;
}

/*────────────────────────────
    Input Elements
────────────────────────────*/
input[type="text"],
input[type="time"],
input[type="datetime-local"] {
    box-sizing: border-box;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
    margin-bottom: 10px;
}

input[type="checkbox"],
input[type="radio"] {
    display: inline-block;
    width: auto;
    margin-right: 5px;
}

/*────────────────────────────
    Button Styles
────────────────────────────*/
button {
    background: #007BFF;
    color: #fff;
    text-align: center;
    border: none;
    border-radius: 4px;
    padding: 8px;
    cursor: pointer;
    margin-bottom: 10px;
    font-size: 1em;
    width: 100%;
}

button:hover {
    background: #0056b3;
}

.controls-container {
    gap: 8px;
    padding: 4px;
    width: 100%;
    box-sizing: border-box;
}

.select-div {
    padding: 4px;
}

.input-date-div {
    margin-bottom: 10px;
}

.select-div {
    padding: 4px;
}

.input-date-div {
    margin-bottom: 10px;
}

/* Large Page Navigation Button */
.btn-page {
    padding: 10px;         /* 余白を増やして大きく見せる */
    font-size: 1.0em;       /* フォントサイズを大きく */
    width: 100%;            /* 全幅を占める */
    font-weight: bold;      /* 太字で目立たせる */
}

/* Small Button Variants */
.btn-small {
    padding: 5px;           /* 余白を小さく */
    font-size: 0.9em;       /* 少し小さめのフォント */
    width: auto;
    display: inline-block;
    margin-bottom: 5px;
}

/*────────────────────────────
    Grouping Helpers
────────────────────────────*/
.weekday-group label {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.btn-group {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.btn-group button {
    flex: 1 1 auto;
    margin-bottom: 0;
}

.time-group,
.weekday-group {
    margin-top: 10px;
}

/*────────────────────────────
    Navigation Footer & Buttons
────────────────────────────*/
.nav-footer {
    position: fixed;
    background-color: #ffffff;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 5px;
    color: #666;
    cursor: pointer;
}

.nav-btn:hover,
.nav-btn:active {
    color: #007bff;
}

.nav-btn i {
    font-size: 24px;
    margin-bottom: 2px;
}

.nav-btn span {
    font-size: 12px;
}

.main-content-alerts {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding-bottom: 20px;
}

/*────────────────────────────
    Media Queries - Landscape Mode
────────────────────────────*/
@media screen and (orientation: landscape) {
    html,
    body {
        width: calc(100vw - 80px);
        height: 100vh;
    }

    body.live-all {
        width: calc(100vw - 80px);
        height: 100vh;
        margin-right: 80px; 
    }

    .controls-container {
        display: flex;
        flex-direction: row;
        align-items: center;
    }

    .input-date-div {
        margin-bottom: 0;
        margin-right: 80px; /* フッター用スペース */
    }

    .nav-footer {
        top: 0;
        right: 0;
        width: 80px;
        height: 100vh;
        flex-direction: column;
        box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    }

    .nav-btn {
        width: 100%;
        height: 20%;
    }

    .landscape-footer {
        bottom: 0;
        right: 0;
        width: 80px;
        height: 100vh;
        flex-direction: column;
        box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    }
    
    .landscape-footer .nav-btn {
        width: 100%;
        height: 20%;
    }
}

/*────────────────────────────
    Media Queries - Portrait Mode
────────────────────────────*/
@media screen and (orientation: portrait){
    html,body{
        width:100vw;
        height:100vh;
        overflow:hidden;
    }

    #camera-grid{
        height:calc(100vh - 80px);   /* ← フッターを除いた高さ */
        overflow-y:auto;
        -webkit-overflow-scrolling:touch;
        display:flex !important;
        flex-direction:column;
        align-items:center;
        gap:12px;
        padding:8px 0;
    }

    .camera-container{
        flex:0 0 auto;              /* shrink = 0 */
        width:80vw;
        max-width:720px;            /* タブレット巨大化を抑止 */
        position:relative;
    }

    .camera-video{
        position:absolute; inset:0;
        width:100%; height:100%;
        object-fit:cover;
    }

    .nav-footer {
        bottom: 0;
        left: 0;
        width: 100%;
        height: 80px;
        flex-direction: row;
        box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    }

    .nav-btn {
        width: 20%;
        height: 100%;
    }
}


/*────────────────────────────
    Camera Grid & Canvas
────────────────────────────*/
.camera-grid {
    width: 100%;
    height: 100%;
    display: grid;
    gap: 0;
    box-sizing: border-box;
    background-color: #ffffff;
    justify-content: start;
    align-items: start;
}

.camera-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background-color: #333;
}

.camera-container {
    position: relative;
    overflow: hidden;     /* はみ出した分を切り捨てたい場合 */
  }

.camera-container.hidden {
    display: none;
}
  
.camera-video {
    width: 100%;
    height: 100%;
    object-fit: cover;    /* ← 16:9 のままセルを全面マスク。黒帯を残すなら "contain" */
}

.camera-label {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 12px;
    z-index: 10;
}


/*────────────────────────────
    Microphone Button Styles
────────────────────────────*/
#mic-btn {
    width: 80px;
    height: 80px;
    font-size: 32px;
    font-weight: bold;
    background-color: #4CAF50;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,.3);
    display: none;
    transition: all 0.2s ease;
    align-items: center;
    justify-content: center;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  
  #mic-btn:active { 
    transform: translateY(1px); 
  }


/*────────────────────────────
    Responsive Adjustments
────────────────────────────*/
@media (max-width: 400px) {
    button,
    input {
        font-size: 1.1em;
    }
}

/*────────────────────────────
    Schedule Display Styles
────────────────────────────*/
/* Day Container (Card Style) */
.day-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
    padding: 10px;
}

/* Day Header */
.day-header {
    font-weight: bold;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Regular Schedule Input Rows */
.regular-time-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}

/* Temporary Schedule Table */
/* 一時スケジュール全体のコンテナ */
#temporary-schedule {
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden; /* 横方向のはみ出しを防止 */
}

/* テーブルコンテナ */
.table-container {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* 列幅を固定 */
    margin-bottom: 10px;
}

/* テーブル全体のスタイル */
#temp-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* 列幅を固定 */
    margin-bottom: 10px;
    max-width: 100%; /* 親要素の幅を超えないように */
}

/* テーブルセル共通スタイル */
#temp-table th,
#temp-table td {
    padding: 4px 2px;
    border: 1px solid #ddd;
    text-align: center;
    vertical-align: middle; /* 垂直方向中央揃え */
    height: 36px; /* セルの高さを固定 */
    line-height: 1.2; /* 行の高さを調整 */
}

/* テーブルヘッダー */
#temp-table th {
    background-color: #f2f2f2;
    font-size: 0.85em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: bold;
}

/* 列の幅を設定 */
#temp-table th:nth-child(1),
#temp-table td:nth-child(1) {
    width: 30%;
}

#temp-table th:nth-child(2),
#temp-table td:nth-child(2),
#temp-table th:nth-child(3),
#temp-table td:nth-child(3) {
    width: 25%;
}

#temp-table th:nth-child(4),
#temp-table td:nth-child(4) {
    width: 15%;
}

/* 入力フィールド共通スタイル */
#temp-table input {
    width: 95%;
    padding: 2px;
    box-sizing: border-box;
    font-size: 0.85em;
    height: 28px; /* 高さを固定 */
    margin: 0; /* マージンをリセット */
}

/* 削除ボタンのスタイル */
#temp-table button {
    padding: 2px 4px;
    font-size: 0.75em;
    width: auto;
    min-width: 40px;
    height: 28px; /* 高さを固定 */
    margin: 0 auto; /* 水平方向中央揃え */
    display: inline-block; /* ブロック要素として表示 */
}

/* 追加ボタン */
#temporary-schedule > button {
    margin-top: 5px;
    padding: 4px 8px;
    width: auto;
    display: inline-block;
}


.mode-option{
    display:flex; align-items:center; gap:12px;
    padding:15px; border:1px solid #ddd; border-radius:8px;
    background:#f9f9f9; cursor:pointer;
}
.mode-option input{margin-right:4px;}

.mode-option input:checked + .mode-label{
    font-weight:bold;
}
.mode-option.selected{
    background:#e6f7ff; border-color:#1890ff;
}
  


.pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    gap: 15px;
}

.pagination-wrapper button {
    width: auto;
    min-width: 100px;
    padding: 8px 16px;
    background-color: #f8f9fa;
    color: #007bff;
    border: 1px solid #007bff;
    transition: all 0.3s ease;
}

.pagination-wrapper button:hover {
    background-color: #007bff;
    color: white;
}

.pagination-wrapper span {
    font-size: 1.1em;
    color: #6c757d;
    padding: 0 10px;
}