/* ============================================================
   assets/style.css - 坂本工業 ファイル便 スタイルシート
   ============================================================ */

/* CSS変数（カラーテーマ） */
:root {
    --primary:       #1a5276;
    --primary-dark:  #154360;
    --primary-light: #2e86c1;
    --accent:        #e74c3c;
    --accent-dark:   #c0392b;
    --success:       #27ae60;
    --warning:       #f39c12;
    --info:          #2980b9;
    --text:          #2c3e50;
    --text-muted:    #7f8c8d;
    --bg:            #f0f4f8;
    --bg-card:       #ffffff;
    --border:        #d5dbdb;
    --border-light:  #eaecee;
    --shadow:        0 2px 8px rgba(0,0,0,0.10);
    --shadow-md:     0 4px 16px rgba(0,0,0,0.14);
    --radius:        8px;
    --radius-sm:     4px;
    --transition:    0.2s ease;
}

/* リセット・ベース */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Meiryo', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

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

img {
    max-width: 100%;
}

/* ============================================================
   レイアウト
   ============================================================ */

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-sm {
    max-width: 500px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-md {
    max-width: 780px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================================
   ヘッダー
   ============================================================ */

.header {
    background: var(--primary);
    color: white;
    padding: 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 24px;
}

.header-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.05em;
    text-decoration: none;
    line-height: 1.2;
}
.header-logo:hover {
    color: white;
    text-decoration: none;
}
.header-logo span {
    font-size: 0.75rem;
    opacity: 0.75;
    display: block;
    font-weight: 400;
    letter-spacing: 0.02em;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.9rem;
}

.header-user-name {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
}
.header-user-name:hover {
    color: white;
    text-decoration: none;
}

/* ユーザードロップダウン */
.user-dropdown {
    position: relative;
}
.user-dropdown-trigger {
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255,255,255,0.9);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    font-family: inherit;
    text-decoration: none;
    white-space: nowrap;
}
.user-dropdown-trigger:hover {
    background: rgba(255,255,255,0.15);
    color: white;
    text-decoration: none;
}
.user-dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    min-width: 160px;
    display: none;
    z-index: 300;
    overflow: hidden;
}
.user-dropdown.active .user-dropdown-menu {
    display: block;
}
.user-dropdown-item {
    display: block;
    padding: 12px 16px;
    color: var(--text);
    font-size: 0.9rem;
    text-decoration: none;
    transition: background var(--transition);
    border-bottom: 1px solid var(--border-light);
}
.user-dropdown-item:last-child {
    border-bottom: none;
}
.user-dropdown-item:hover {
    background: var(--bg);
    color: var(--text);
    text-decoration: none;
}
.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* ============================================================
   フッター
   ============================================================ */

.footer {
    background: var(--primary-dark);
    color: rgba(255,255,255,0.6);
    text-align: center;
    padding: 18px;
    font-size: 0.8rem;
    margin-top: auto;
}

/* ============================================================
   カード
   ============================================================ */

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-bottom: 24px;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================================
   ボタン
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
    white-space: nowrap;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    text-decoration: none;
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
}

.btn-accent {
    background: var(--accent);
    color: white;
}

.btn-accent:hover {
    background: var(--accent-dark);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #1e8449;
    color: white;
}

.btn-secondary {
    background: #ecf0f1;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #d5dbdb;
    color: var(--text);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 13px 32px;
    font-size: 1.05rem;
}

.btn-block {
    width: 100%;
    display: flex;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-danger {
    background: var(--accent);
    color: white;
}

.btn-danger:hover {
    background: var(--accent-dark);
    color: white;
}

/* ============================================================
   フォーム
   ============================================================ */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 6px;
}

.form-label .required {
    color: var(--accent);
    margin-left: 3px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    color: var(--text);
    background: white;
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(46,134,193,0.15);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-error {
    font-size: 0.82rem;
    color: var(--accent);
    margin-top: 4px;
}

/* メールタグ入力エリア */
.tag-input-wrapper {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    background: white;
    min-height: 44px;
    cursor: text;
    transition: border-color var(--transition), box-shadow var(--transition);
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.tag-input-wrapper:focus-within {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(46,134,193,0.15);
}

.tag-input-wrapper input {
    border: none;
    outline: none;
    flex: 1;
    min-width: 160px;
    font-size: 0.92rem;
    padding: 2px 4px;
    font-family: inherit;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #d6eaf8;
    color: var(--primary);
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 0.85rem;
    font-weight: 500;
}

.tag-remove {
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: var(--primary);
    opacity: 0.6;
    padding: 0 2px;
}

.tag-remove:hover {
    opacity: 1;
    color: var(--accent);
}

/* CC/BCCトグル */
.cc-toggle-btn {
    background: none;
    border: none;
    color: var(--primary-light);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px 0;
    text-decoration: underline;
}

.cc-section {
    display: none;
}

.cc-section.active {
    display: block;
}

/* ============================================================
   ファイルドロップゾーン
   ============================================================ */

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    background: #fafbfc;
}

.drop-zone.drag-over {
    border-color: var(--primary-light);
    background: #eaf4fb;
}

.drop-zone:hover {
    border-color: var(--primary-light);
}

.drop-zone-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

.drop-zone-text {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.drop-zone-text strong {
    color: var(--primary-light);
}

.file-input-hidden {
    display: none;
}

/* ファイルリスト */
.file-list {
    margin-top: 14px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 8px;
}

.file-item-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

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

.file-item-name {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-item-size {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.file-item-remove {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity var(--transition);
}

.file-item-remove:hover {
    opacity: 1;
}

/* ============================================================
   テーブル
   ============================================================ */

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.9rem;
}

.table th {
    background: var(--primary);
    color: white;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

.table th:first-child {
    border-radius: var(--radius) 0 0 0;
}

.table th:last-child {
    border-radius: 0 var(--radius) 0 0;
}

.table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: #f8fbff;
}

/* ============================================================
   バッジ・ステータス
   ============================================================ */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-success {
    background: #d5f5e3;
    color: #1e8449;
}

.badge-danger {
    background: #fde8e6;
    color: #c0392b;
}

.badge-warning {
    background: #fef9e7;
    color: #b7770d;
}

.badge-info {
    background: #d6eaf8;
    color: #1a5276;
}

/* ============================================================
   アラート
   ============================================================ */

.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.92rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success {
    background: #d5f5e3;
    border-left: 4px solid var(--success);
    color: #1a6b3c;
}

.alert-error, .alert-danger {
    background: #fde8e6;
    border-left: 4px solid var(--accent);
    color: #8b1a1a;
}

.alert-warning {
    background: #fef9e7;
    border-left: 4px solid var(--warning);
    color: #7b5400;
}

.alert-info {
    background: #d6eaf8;
    border-left: 4px solid var(--info);
    color: #1a3d6b;
}

/* ============================================================
   モーダル
   ============================================================ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalIn 0.22s ease;
}

@keyframes modalIn {
    from { transform: scale(0.92) translateY(-20px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px 8px;
    line-height: 1;
    transition: color var(--transition);
}

.modal-close:hover {
    color: var(--accent);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ============================================================
   ログイン・初回登録ページ
   ============================================================ */

.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
    padding: 20px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
    color: white;
}

.auth-logo-icon {
    font-size: 3rem;
    margin-bottom: 8px;
}

.auth-logo-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.auth-logo-sub {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-top: 4px;
}

.auth-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    padding: 36px 32px;
    width: 100%;
    max-width: 420px;
}

.auth-card h2 {
    font-size: 1.15rem;
    color: var(--primary);
    margin-bottom: 24px;
    text-align: center;
}

/* ============================================================
   ダッシュボードのメニューカード
   ============================================================ */

.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 24px;
}

.menu-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 24px;
    text-align: center;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    border: 2px solid transparent;
    text-decoration: none;
    color: var(--text);
    display: block;
}

.menu-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
    text-decoration: none;
    color: var(--text);
}

.menu-card-icon {
    font-size: 2.6rem;
    margin-bottom: 12px;
    display: block;
}

.menu-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
}

.menu-card-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ============================================================
   ページヘッダー（ページ内タイトル）
   ============================================================ */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-light);
}

.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
}

.page-title small {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 10px;
}

/* ============================================================
   検索バー
   ============================================================ */

.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.search-bar .form-control {
    flex: 1;
}

/* ============================================================
   ダウンロードページ専用
   ============================================================ */

.download-page {
    min-height: 100vh;
    background: var(--bg);
    display: flex;
    flex-direction: column;
}

.download-header {
    background: var(--primary);
    color: white;
    padding: 16px 24px;
    font-size: 1.05rem;
    font-weight: 700;
}

.download-content {
    flex: 1;
    padding: 32px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.download-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 36px 32px;
    width: 100%;
    max-width: 560px;
}

.download-info-row {
    display: flex;
    margin-bottom: 12px;
    font-size: 0.92rem;
}

.download-info-label {
    font-weight: 600;
    color: var(--text-muted);
    width: 80px;
    flex-shrink: 0;
}

.passcode-input-group {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.passcode-input {
    flex: 1;
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 0.3em;
    font-weight: 700;
    padding: 12px;
}

/* ============================================================
   ローディングオーバーレイ
   ============================================================ */

.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    color: white;
    font-size: 1rem;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   アドレス帳モーダル内リスト
   ============================================================ */

.contact-list {
    list-style: none;
    max-height: 360px;
    overflow-y: auto;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background var(--transition);
    gap: 12px;
}

.contact-item:hover {
    background: #f0f7ff;
}

.contact-item:last-child {
    border-bottom: none;
}

.contact-avatar {
    width: 38px;
    height: 38px;
    background: var(--primary-light);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.contact-info-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.contact-info-email {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.contact-info-company {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ============================================================
   パスコード試行カウンター
   ============================================================ */

.attempt-counter {
    font-size: 0.82rem;
    color: var(--accent);
    margin-top: 6px;
}

/* ============================================================
   レスポンシブ（タブレット: 768px以下）
   ============================================================ */

@media (max-width: 768px) {
    .container {
        padding: 0 14px;
    }

    .menu-grid {
        grid-template-columns: 1fr 1fr;
        gap: 14px;
    }

    .menu-card {
        padding: 20px 14px;
    }

    .menu-card-icon {
        font-size: 2rem;
    }

    .header-inner {
        padding: 0 14px;
    }

    .header-logo span {
        display: none;
    }

    .table {
        font-size: 0.82rem;
    }

    .table th, .table td {
        padding: 9px 10px;
    }

    .auth-card {
        padding: 28px 22px;
    }

    .download-card {
        padding: 28px 22px;
    }

    .modal {
        margin: 10px;
    }
}

/* ============================================================
   レスポンシブ（スマホ: 480px以下）
   ============================================================ */

@media (max-width: 480px) {
    html {
        font-size: 15px;
    }

    .menu-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .btn-lg {
        padding: 12px 20px;
        font-size: 1rem;
    }

    .search-bar {
        flex-direction: column;
    }

    .card {
        padding: 18px 16px;
    }

    .auth-card {
        padding: 22px 16px;
    }

    .auth-logo-title {
        font-size: 1.25rem;
    }

    .passcode-input {
        font-size: 1.3rem;
        letter-spacing: 0.2em;
    }

    .download-card {
        padding: 22px 16px;
    }

    .modal-body {
        padding: 18px;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

/* ============================================================
   ユーティリティ
   ============================================================ */

.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 20px; }
.mt-4 { margin-top: 28px; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 20px; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-danger { color: var(--accent); }
.text-success { color: var(--success); }
.text-primary { color: var(--primary); }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }
.font-bold { font-weight: 700; }
.font-sm { font-size: 0.85rem; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* main wrapper */
.main-content {
    padding: 30px 0 50px;
    flex: 1;
}

.site-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
