/* style.css */

/* --- 1. Material You 3 风格颜色和变量定义 --- */
:root {
    --md-sys-color-primary: #6750A4;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #EADDFF;
    --md-sys-color-on-primary-container: #21005D;
    --md-sys-color-surface: #FFFBFE;
    --md-sys-color-surface-variant: #E7E0EC;
    --md-sys-color-on-surface: #1C1B1F;
    --md-sys-color-on-surface-variant: #49454F;
    --md-sys-color-outline: #79747E;
    --md-sys-color-shadow: #000000;
    --md-sys-color-error: #B3261E;
    --md-sys-color-success: #28a745;
    --border-radius-large: 16px;
    --border-radius-medium: 12px;
    --border-radius-small: 8px;
}

/* --- 2. 基础和布局样式 --- */
body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 700px;
}

header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

header h1 {
    font-size: 2.5rem;
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 700;
    margin: 0;
}

.logo-icon {
    font-size: 3rem;
    color: var(--md-sys-color-primary);
}

/* --- 3. 卡片和通用组件 --- */
.card {
    background-color: var(--md-sys-color-surface);
    border-radius: var(--border-radius-large);
    padding: 24px;
    box-shadow: 0 4px 8px rgba(var(--md-sys-color-shadow), 0.1);
    transition: box-shadow 0.3s ease;
}
.card:hover {
    box-shadow: 0 6px 12px rgba(var(--md-sys-color-shadow), 0.15);
}

h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.5rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 40px;
    margin-bottom: 16px;
}

/* --- 4. 上传区域样式 --- */
.upload-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.drop-zone {
    border: 2px dashed var(--md-sys-color-outline);
    border-radius: var(--border-radius-medium);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
.drop-zone:hover, .drop-zone.dragover {
    background-color: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
}
.drop-zone .drop-icon {
    font-size: 48px;
    color: var(--md-sys-color-primary);
}
.drop-zone p {
    margin: 8px 0 0;
    color: var(--md-sys-color-on-surface-variant);
}
.file-name-display {
    font-weight: 500;
    color: var(--md-sys-color-primary);
    margin-top: 10px !important;
    min-height: 1.2em;
}

.options {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--md-sys-color-on-surface-variant);
}

#expirySelect {
    background-color: var(--md-sys-color-surface-variant);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--border-radius-small);
    padding: 8px 12px;
    font-size: 1rem;
}

#uploadButton {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    border-radius: 50px; /* M3 风格的胶囊按钮 */
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}
#uploadButton:hover:not(:disabled) {
    box-shadow: 0 2px 8px rgba(var(--md-sys-color-shadow), 0.2);
}
#uploadButton:disabled {
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
    cursor: not-allowed;
}
#uploadButton .button-text {
    transition: opacity 0.2s ease;
}
#uploadButton.loading .button-text {
    opacity: 0;
}
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--md-sys-color-on-primary);
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    position: absolute;
    opacity: 0;
    transition: opacity 0.2s ease;
}
#uploadButton.loading .spinner {
    opacity: 1;
}

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

.status-message {
    text-align: center;
    font-weight: 500;
    min-height: 1.2em;
    transition: color 0.3s ease;
}
.status-message.success { color: var(--md-sys-color-success); }
.status-message.error { color: var(--md-sys-color-error); }


/* --- 5. 文件历史列表样式 --- */
#fileList ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#fileList li {
    background-color: var(--md-sys-color-surface);
    border-radius: var(--border-radius-medium);
    border: 1px solid var(--md-sys-color-surface-variant);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.file-icon {
    color: var(--md-sys-color-primary);
}

.file-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

.file-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-expiry {
    font-size: 0.8rem;
    color: var(--md-sys-color-error);
}
.file-expiry.expired {
    color: var(--md-sys-color-on-surface-variant);
    text-decoration: line-through;
}

.copy-button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--md-sys-color-on-surface-variant);
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, color 0.3s ease;
}
.copy-button:hover {
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-primary);
}

/* --- 6. 页脚 --- */
footer {
    text-align: center;
    margin-top: 40px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.9rem;
}