/**
 * 计数器工具样式
 */

.pwt-counter {
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* 工具栏 */
.pwt-counter-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 24px;
    padding: 12px 0;
    border-bottom: 1px solid #e8eaed;
    gap: 12px;
}

.pwt-counter-toolbar .pwt-button {
    display: flex;
    align-items: center;
    border: none;
    border-radius: 6px;
    padding: 10px 18px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-size: 14px;
}

.pwt-counter-toolbar .pwt-counter-add-new-btn {
    background-color: #3a7bc2;
    color: white;
}

.pwt-counter-toolbar .pwt-counter-history-btn {
    background-color: #3a7bc2;
    color: white;
    opacity: 0.9;
}

.pwt-counter-toolbar .pwt-button .dashicons {
    margin-right: 6px;
}

.pwt-counter-toolbar .pwt-counter-add-new-btn:hover {
    background-color: #2d6cb1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.pwt-counter-toolbar .pwt-counter-history-btn:hover {
    background-color: #2d6cb1;
    opacity: 1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

/* 计数器卡片容器 */
.pwt-counter-cards-container {
   
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-gap: 20px;
}

/* 计数器卡片 */
.pwt-counter-card {
    background-color: white;
    border-radius: 12px;
    margin-top: 30px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    border: 1px solid #f0f4f8;
}

.pwt-counter-card:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    transform: translateY(-3px);
}

.pwt-counter-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background-color: #f9fafc;
    border-bottom: 1px solid #edf1f7;
}

.pwt-counter-card-title {
    font-size: 17px;
    font-weight: 600;
    flex-grow: 1;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100% - 80px);
    letter-spacing: 0.2px;
}

.pwt-counter-card-actions {
    display: flex;
    gap: 8px;
}

.pwt-counter-card-actions .pwt-button {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    color: #666;
    transition: all 0.2s ease;
}

.pwt-counter-card-actions .pwt-button:hover {
    background-color: rgba(58, 123, 194, 0.1);
}

.pwt-counter-card-actions .pwt-counter-delete-btn:hover {
    color: #e53e3e;
    background-color: rgba(229, 62, 62, 0.1);
}

.pwt-counter-card-actions .pwt-counter-settings-btn:hover {
    color: #3a7bc2;
}

.pwt-counter-card-body {
    padding: 16px;
    text-align: center;
}

/* 计数值容器 */
.pwt-counter-value-container {
    position: relative;
    margin-bottom: 20px;
    margin-top: 5px;
}

.pwt-counter-value-display {
    font-size: 54px;
    font-weight: bold;
    line-height: 1.1;
    padding: 12px;
    cursor: pointer;
    user-select: none;
    transition: all 0.25s ease;
    color: #3a7bc2;
    border-radius: 12px;
    display: inline-block;
    min-width: 130px;
}

.pwt-counter-value-display:hover {
    transform: scale(1.03);
    background-color: #f5f9fd;
}

.pwt-counter-status {
    position: absolute;
    top: -10px;
    right: 0;
    background-color: #3a7bc2;
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: none;
    animation: fadeIn 0.5s;
    box-shadow: 0 2px 6px rgba(58, 123, 194, 0.25);
}

/* 计数控制按钮 */
.pwt-counter-controls {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 22px;
}

.pwt-counter-plus-btn,
.pwt-counter-minus-btn {
    width: 64px;
    height: 64px;
    font-size: 32px!important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    box-shadow: 0 3px 8px rgba(0,0,0,0.08);
}

.pwt-counter-plus-btn {
    background-color: #3a7bc2;
    color: white;
}

.pwt-counter-minus-btn {
    background-color: #f8fafc;
    color: #3a7bc2;
    border: 1px solid #e0e7f1 !important;
}

.pwt-counter-plus-btn:hover {
    background-color: #2d6cb1;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(58, 123, 194, 0.25);
}

.pwt-counter-minus-btn:hover {
    background-color: #edf2f7;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.pwt-counter-plus-btn:active,
.pwt-counter-minus-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

/* 辅助操作按钮 */
.pwt-counter-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 35px;
    margin-bottom: 15px;
}

.pwt-counter-actions .pwt-counter-btn {
    padding: 8px 16px;
    font-size: 14px;
    border: 1px solid #e0e7f1;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    min-width: 80px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.pwt-counter-reset-btn {
    background-color: #fff1e6;
    color: #dd6b20;
    border-color: #fbd5bd !important;
}

.pwt-counter-reset-btn:hover {
    background-color: #feebc8;
    color: #c05621;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(221, 107, 32, 0.15);
}

.pwt-counter-undo-btn {
    background-color: #f5f9fd;
    color: #3a7bc2;
}

.pwt-counter-undo-btn:hover:not(:disabled) {
    background-color: #edf2f7;
    color: #2d6cb1;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(58, 123, 194, 0.15);
}

.pwt-counter-undo-btn:disabled {
    background-color: #f8fafc;
    color: #a0aec0;
    border-color: #edf2f7;
    cursor: not-allowed;
    box-shadow: none;
}

/* 模态对话框 */
.pwt-counter-settings-panel,
.pwt-counter-add-panel,
.pwt-counter-edit-value-panel,
.pwt-counter-history-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(3px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwt-counter-modal-content {
    background-color: white;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    padding: 24px;
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalFadeIn 0.3s;
    border: 1px solid #edf2f7;
}

.pwt-counter-settings-header,
.pwt-counter-add-header,
.pwt-counter-edit-value-header,
.pwt-counter-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid #edf2f7;
}

.pwt-counter-settings-header h4,
.pwt-counter-add-header h4,
.pwt-counter-edit-value-header h4,
.pwt-counter-history-header h4 {
    margin: 0;
    font-size: 20px;
    color: #2d3748;
    font-weight: 600;
}

.pwt-counter-close-btn {
    background: none;
    border: none;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    color: #718096;
    transition: all 0.2s ease;
}

.pwt-counter-close-btn:hover {
    background-color: #f7fafc;
    color: #4a5568;
}

/* 表单样式 */
.pwt-form-group {
    margin-bottom: 22px;
}

.pwt-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #4a5568;
    font-size: 15px;
}

.pwt-input {
    width: 100%;
    padding: 12px 5px ;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 15px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) inset;
    color: #2d3748;
}

.pwt-input:focus {
    border-color: #3a7bc2;
    outline: none;
    box-shadow: 0 0 0 3px rgba(58, 123, 194, 0.15);
}

.pwt-description {
    font-size: 13px;
    color: #718096;
    margin-top: 6px;
    margin-bottom: 0;
    line-height: 1.4;
}

.pwt-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #edf2f7;
}

.pwt-button {
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.pwt-button-secondary {
    background-color: #f8fafc;
    color: #4a5568;
    border-color: #e2e8f0;
}

.pwt-button-secondary:hover {
    background-color: #f1f5f9;
    color: #2d3748;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.pwt-counter-save-settings-btn,
.pwt-counter-create-btn,
.pwt-counter-save-value-btn {
    background-color: #3a7bc2;
    color: white;
}

.pwt-counter-save-settings-btn:hover,
.pwt-counter-create-btn:hover,
.pwt-counter-save-value-btn:hover {
    background-color: #2d6cb1;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(58, 123, 194, 0.25);
}

/* 危险按钮 */
.pwt-button-danger {
    background-color: #e53e3e;
    color: white;
    border-color: #e53e3e;
}

.pwt-button-danger:hover {
    background-color: #c53030;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(229, 62, 62, 0.25);
}

/* 历史记录面板 */
.pwt-counter-history-modal {
    max-width: 850px;
    width: 92%;
}

.pwt-counter-history-list {
    max-height: 450px;
    overflow-y: auto;
    margin-bottom: 20px;
    border-radius: 10px;
    border: 1px solid #edf2f7;
}

.pwt-history-empty {
    text-align: center;
    padding: 30px;
    color: #718096;
    font-style: italic;
    background-color: #f8fafc;
    border-radius: 8px;
    font-size: 15px;
    margin: 10px 0;
}

.pwt-history-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 0;
    font-size: 14px;
}

.pwt-history-table th,
.pwt-history-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #edf2f7;
}

.pwt-history-table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #4a5568;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid #e2e8f0;
}

.pwt-history-table th:first-child {
    border-top-left-radius: 10px;
}

.pwt-history-table th:last-child {
    border-top-right-radius: 10px;
}

.pwt-history-table tbody tr:hover {
    background-color: #f7fafc;
}

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

.pwt-history-time {
    width: 20%;
    font-size: 13px;
    color: #718096;
    white-space: nowrap;
}

.pwt-history-counter {
    width: 20%;
    font-weight: 500;
    color: #4a5568;
}

.pwt-history-action {
    width: 15%;
    color: #3a7bc2;
    font-weight: 600;
}

.pwt-history-action.pwt-history-increment {
    color: #38a169;
}

.pwt-history-action.pwt-history-decrement {
    color: #e53e3e;
}

.pwt-history-change {
    width: 45%;
    color: #2d3748;
    line-height: 1.4;
}

.pwt-counter-history-actions {
    justify-content: space-between;
    padding-top: 16px;
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* 响应式适配 */
@media (max-width: 900px) {
    .pwt-counter-cards-container {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        grid-gap: 20px;
    }
}

@media (max-width: 768px) {
    .pwt-counter-cards-container {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        grid-gap: 16px;
    }
    
    .pwt-counter-modal-content {
        padding: 18px;
        width: 95%;
    }
    
    .pwt-counter-toolbar {
        flex-wrap: wrap;
    }
    
    .pwt-counter-history-list {
        max-height: 350px;
    }
    
    .pwt-history-table th,
    .pwt-history-table td {
        padding: 10px 12px;
    }
}

@media (max-width: 540px) {
    .pwt-counter-cards-container {
        grid-template-columns: 1fr;
    }
    .pwt-counter-controls{gap: 50px;}
    .pwt-counter-value-display {
        font-size: 48px;
    }
    
    .pwt-counter-plus-btn,
    .pwt-counter-minus-btn {
        width: 56px;
        height: 56px;
        font-size: 28px;
    }
    
    .pwt-counter-modal-content {
        width: 95%;
        padding: 16px;
        border-radius: 10px;
    }
    
    .pwt-form-actions {
        flex-direction: column;
    }
    
    .pwt-form-actions button {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .pwt-counter-history-modal {
        width: 100%;
        max-width: none;
        height: 100%;
        max-height: 100vh;
    }
    
    .pwt-counter-history-list {
        max-height: calc(100vh - 200px);
    }
    
    .pwt-history-table {
        font-size: 13px;
    }
    
    .pwt-history-time {
        width: 30%;
    }
    
    .pwt-history-counter {
        width: 25%;
    }
    
    .pwt-history-action {
        width: 20%;
    }
    
    .pwt-history-change {
        width: 25%;
    }
}
