/**
 * グリッドレイアウトフロントエンド用スタイル
 */

/* グリッドレイアウトコンテナの基本スタイル */
.grid-layout-container {
    display: grid;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 2rem;
}

/* グリッドエリアの基本スタイル */
.grid-layout-container .grid-area {
    box-sizing: border-box;
    overflow: auto;
}

/* エリア内のコンテンツのマージンをリセット */
.grid-area > h1:first-child,
.grid-area > h2:first-child,
.grid-area > h3:first-child,
.grid-area > p:first-child {
    margin-top: 0;
}

.grid-area > *:last-child {
    margin-bottom: 0;
}

/* エラーメッセージ */
.grid-error {
    padding: 15px;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin-bottom: 1rem;
}

/* レスポンシブ対応のためのユーティリティクラス */
@media (max-width: 991px) {
    .grid-hide-tablet {
        display: none !important;
    }
}

@media (max-width: 767px) {
    .grid-hide-mobile {
        display: none !important;
    }
}

/* コンテンツタイプ別のスタイル調整 */

/* ウィジェットエリア */
.grid-area .widget {
    margin-bottom: 1rem;
}

.grid-area .widget:last-child {
    margin-bottom: 0;
}

.grid-area .widget-title {
    margin-top: 0;
}

/* 画像 */
.grid-area img {
    max-width: 100%;
    height: auto;
}

/* テーブル */
.grid-area table {
    width: 100%;
    border-collapse: collapse;
}

.grid-area th,
.grid-area td {
    padding: 0.5rem;
    border: 1px solid #ddd;
}

/* レスポンシブ対応 */
@media (max-width: 991px) {
    /* タブレット用の共通スタイル */
    .grid-layout-container {
        gap: 15px;
    }
}

@media (max-width: 767px) {
    /* モバイル用の共通スタイル */
    .grid-layout-container {
        gap: 10px;
    }
    
    /* スタック表示 */
    .grid-layout-container.stack-on-mobile {
        display: flex;
        flex-direction: column;
    }
    
    .grid-layout-container.stack-on-mobile .grid-area {
        grid-column: 1 / -1 !important;
        margin-bottom: 15px;
    }
}