/* 合約客戶插件 - 前台樣式 */

/* ========== 登入頁面樣式 ========== */
.instig-contract-login-wrapper {
    max-width: 500px;
    margin: 50px auto;
    padding: 20px;
}

.instig-contract-login-box {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 50px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h2 {
    margin: 0 0 10px;
    color: #333;
    font-size: 28px;
    font-weight: 700;
}

.login-header p {
    margin: 0;
    color: #666;
    font-size: 15px;
}

.login-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
}

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

.instig-contract-login-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.instig-contract-login-form input[type="text"],
.instig-contract-login-form input[type="password"] {
    width: 100%;
    padding: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.instig-contract-login-form input[type="text"]:focus,
.instig-contract-login-form input[type="password"]:focus {
    border-color: #C89F65;
    outline: none;
}

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    margin: 0;
    font-weight: normal;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 8px;
}

.login-button {
    width: 100%;
    padding: 14px;
    background: #C89F65;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.login-button:hover {
    background: #B08A52;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.login-footer p {
    margin: 0;
    color: #666;
    font-size: 13px;
}

/* ========== 客戶儀表板樣式 ========== */
.instig-contract-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-info h2 {
    margin: 0 0 5px;
    color: #333;
    font-size: 24px;
}

.company-name {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    font-weight: 500;
}

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

.btn-primary:hover {
    background: #B08A52;
    color: #fff;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-secondary {
    background: #f0f0f1;
    color: #333;
}

.btn-secondary:hover {
    background: #dcdcde;
}

.btn-logout {
    background: #d63638;
    color: #fff;
}

.btn-logout:hover {
    background: #b32d2e;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-download {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-download:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-download .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

.btn-rename {
    background: #f59e0b;
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
    border: none;
    cursor: pointer;
}

.btn-rename:hover {
    background: #d97706;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.btn-rename .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

.btn-delete {
    background: #dc2626;
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
    border: none;
    cursor: pointer;
}

.btn-delete:hover {
    background: #b91c1c;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

.btn-delete .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

.btn-link {
    color: #2271b1;
    text-decoration: none;
}

.btn-link:hover {
    text-decoration: underline;
}

/* 修改密碼表單 */
.password-form {
    margin-bottom: 30px;
}

.form-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.form-card h3 {
    margin: 0 0 20px;
    color: #333;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.form-message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 4px;
    font-size: 14px;
}

.form-message.success {
    background: #d1e7dd;
    border: 1px solid #badbcc;
    color: #0f5132;
}

.form-message.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* 合約區域 */
.contracts-section h3 {
    margin: 0 0 20px;
    color: #333;
    font-size: 20px;
}

.contract-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.contract-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f1;
}

.contract-toggle {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
    margin: -25px -25px 0 -25px;
    padding: 25px;
    border-radius: 8px 8px 0 0;
}

.contract-toggle:hover {
    background: #f5f5f5;
}

.contract-toggle:active {
    background: #ebebeb;
}

.contract-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.title-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-size: 0;
    color: #C89F65;
    background: #f5f0e8;
    border: 2px solid #C89F65;
    border-radius: 50%;
    transition: all 0.3s ease;
    flex-shrink: 0;
    position: relative;
}

.toggle-icon::before,
.toggle-icon::after {
    content: '';
    position: absolute;
    background: #C89F65;
    transition: all 0.3s ease;
}

/* 水平線 */
.toggle-icon::before {
    width: 12px;
    height: 2px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

/* 垂直線（收起狀態顯示，展開狀態隱藏） */
.toggle-icon::after {
    width: 2px;
    height: 12px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

/* 展開狀態：隱藏垂直線，只保留水平線（變成減號） */
.toggle-icon.expanded::after {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(90deg);
}

.contract-toggle:hover .toggle-icon {
    background: #C89F65;
    border-color: #B08A52;
}

.contract-toggle:hover .toggle-icon::before,
.contract-toggle:hover .toggle-icon::after {
    background: #fff;
}

.contract-title h4 {
    margin: 0;
    color: #333;
    font-size: 20px;
    font-weight: 600;
}

.contract-period {
    color: #666;
    font-size: 13px;
    font-weight: 400;
}

.contract-content {
    overflow: hidden;
    padding-top: 20px;
}

.contract-name {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    display: inline-block;
}

.status-active {
    background: #d1e7dd;
    color: #0f5132;
}

.status-expiring {
    background: #fff3cd;
    color: #856404;
    border: 2px solid #ff0000;
    animation: pulse 2s infinite;
}

.status-expired {
    background: #f8d7da;
    color: #721c24;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(255, 0, 0, 0);
    }
}

.contract-info {
    margin-bottom: 20px;
}

.info-row {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f1;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row .label {
    font-weight: 600;
    color: #666;
    min-width: 120px;
    font-size: 14px;
}

.info-row .value {
    color: #333;
    font-size: 14px;
}

.text-warning {
    color: #d63638 !important;
    font-weight: 600;
}

/* 文件區域 */
.contract-files {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f1;
}

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

.files-header h5 {
    margin: 0;
    color: #333;
    font-size: 16px;
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    transition: background 0.3s;
}

.file-item:hover {
    background: #f0f0f1;
}

.file-icon {
    margin-right: 12px;
    color: #d63638;
    font-size: 24px;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 3px;
    line-height: 1.4;
}

.badge-admin {
    background: #e3f2fd;
    color: #1976d2;
}

.badge-client {
    background: #f3e5f5;
    color: #7b1fa2;
}

.file-meta {
    color: #666;
    font-size: 12px;
}

.file-actions {
    display: flex;
    gap: 5px;
}

.btn-icon {
    padding: 8px;
    color: #2271b1;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon .dashicons {
    width: 20px;
    height: 20px;
    font-size: 20px;
}

.btn-icon:hover {
    background: #e0e0e0;
}

.no-files {
    text-align: center;
    color: #666;
    padding: 20px;
    font-size: 14px;
}

.no-contracts {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.no-contracts p {
    margin: 0;
    color: #666;
    font-size: 16px;
}

/* ========== 模態框樣式 ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-content {
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #ddd;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.modal-header .modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 1;
}

.modal-header .modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-end;
}

.modal-footer .btn {
    min-width: 80px;
}

.upload-progress {
    margin-top: 15px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #f0f0f1;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: #2271b1;
    transition: width 0.3s;
    width: 0;
}

.progress-text {
    text-align: center;
    color: #666;
    font-size: 13px;
}

/* ========== 響應式設計 ========== */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .contract-header {
        flex-direction: column;
        gap: 10px;
    }

    .contract-title h4 {
        font-size: 18px;
    }

    .contract-period {
        font-size: 12px;
    }

    .toggle-icon {
        width: 24px;
        height: 24px;
    }

    .toggle-icon::before {
        width: 10px;
        height: 2px;
    }

    .toggle-icon::after {
        width: 2px;
        height: 10px;
    }

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

    .info-row {
        flex-direction: column;
        gap: 5px;
    }

    .modal-content {
        width: 95%;
    }

    .pagination-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        padding: 15px;
    }

    .pagination-info::before {
        display: none;
    }

    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px;
    }

    .pagination-link {
        min-width: 36px;
        height: 36px;
        padding: 0 10px;
        font-size: 13px;
        gap: 4px;
    }

    .pagination-link svg {
        width: 10px;
        height: 10px;
    }

    .pagination-prev,
    .pagination-next {
        padding: 0 8px;
    }
}

/* ========== 分頁樣式 ========== */
.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(to bottom, #fafafa 0%, #ffffff 100%);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.pagination-info {
    color: #4b5563;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-info::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    background: #C89F65;
    border-radius: 50%;
}

.pagination {
    display: flex;
    gap: 6px;
    align-items: center;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    background: #fff;
    color: #C89F65;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.pagination-link svg {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.pagination-link:hover:not(.disabled):not(.current) {
    background: #C89F65;
    color: #fff;
    border-color: #C89F65;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(200, 159, 101, 0.3);
}

.pagination-link:hover:not(.disabled):not(.current) svg {
    transform: scale(1.1);
}

.pagination-prev:hover:not(.disabled) svg {
    transform: translateX(-2px);
}

.pagination-next:hover:not(.disabled) svg {
    transform: translateX(2px);
}

.pagination-link.current {
    background: linear-gradient(135deg, #C89F65 0%, #B08A52 100%);
    color: #fff;
    border-color: #B08A52;
    cursor: default;
    box-shadow: 0 2px 4px rgba(200, 159, 101, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.pagination-link.disabled {
    background: #f9fafb;
    color: #9ca3af;
    border-color: #e5e7eb;
    cursor: not-allowed;
    opacity: 0.6;
}

.pagination-prev,
.pagination-next {
    font-weight: 600;
    padding: 0 12px;
}

.pagination-ellipsis {
    color: #6b7280;
    padding: 0 8px;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 2px;
}
