/* ======================
   Main Admin Structure
   ====================== */
.wpcs-admin {
    --wpcs-primary: #2271b1;
    --wpcs-danger: #d63638;
    --wpcs-border: #c3c4c7;
    --wpcs-text-secondary: #646970;
    
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ======================
   Header Styles
   ====================== */
.wpcs-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--wpcs-border);
}

.wpcs-header h1 {
    font-size: 23px;
    font-weight: 400;
    margin: 0;
    padding: 0.5rem 0;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--wpcs-primary);
}

.wpcs-header h1 .dashicons {
    color: inherit;
}

.wpcs-header .description {
    margin: 0.25rem 0 0;
    color: var(--wpcs-text-secondary);
    font-size: 1rem;
}

/* ======================
   Card Components
   ====================== */
.wpcs-card {
    background: #fff;
    border: 1px solid var(--wpcs-border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    border-radius: 4px;
}

.wpcs-card .title {
    margin: 0 0 1rem;
    font-size: 1.25rem;
    color: #1d2327;
}

/* ======================
   Form Elements
   ====================== */
.wpcs-form {
    margin-top: 1.5rem;
}

.form-field {
    margin-bottom: 1.25rem;
}

.form-field label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.form-field .description {
    margin-top: 0.5rem;
    color: var(--wpcs-text-secondary);
    font-size: 0.8125rem;
    line-height: 1.4;
}

.short-url-display {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.short-url-display code {
    flex-grow: 1;
    padding: 0.375rem;
    background: #f6f7f7;
    border-radius: 3px;
    font-size: 0.875rem;
}

/* ======================
   Custom Checkbox
   ====================== */
.checkbox-container {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    position: relative;
    cursor: pointer;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 1.25rem;
    width: 1.25rem;
    background-color: #fff;
    border: 1px solid #8c8f94;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--wpcs-primary);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--wpcs-primary);
    border-color: var(--wpcs-primary);
}

.checkbox-container input:focus-visible ~ .checkmark {
    outline: 2px solid var(--wpcs-primary);
    outline-offset: 2px;
}

.checkmark:after {
    content: "✓";
    color: white;
    display: none;
    font-size: 0.75rem;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

/* ======================
   Button Styles
   ====================== */
.form-actions {
    display: flex;
    gap: 0.625rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.form-actions .button-delete,
.wpcs-card .button-delete {
    background: var(--wpcs-danger);
    border-color: var(--wpcs-danger);
    color: white;
    text-shadow: none;
}

.form-actions .button-delete:hover,
.form-actions .button-delete:focus,
.wpcs-card .button-delete:hover,
.wpcs-card .button-delete:focus {
    background: #b32d2e;
    border-color: #b32d2e;
}

.form-actions .button-delete:focus,
.wpcs-card .button-delete:focus {
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--wpcs-danger);
}

/* ======================
   Table Styles
   ====================== */
.table-container {
    overflow-x: auto;
    margin-top: 1.25rem;
    -webkit-overflow-scrolling: touch;
}

.wp-list-table {
    margin-top: 0;
    width: 100%;
}

.wp-list-table th {
    font-weight: 600;
}

.wp-list-table th.text-center,
.wp-list-table td.text-center {
    text-align: center;
}

.wp-list-table .click-count {
    font-weight: 600;
    color: var(--wpcs-primary);
}

.wp-list-table .actions {
    width: 10rem;
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 0.3125rem;
}

/* Daily stats specific */
.daily-stats-container {
    margin-bottom: 1.5rem;
}

.daily-stats th, 
.daily-stats td {
    padding: 0.5rem 0.625rem;
}

.daily-stats th {
    background: #f0f0f1;
}

.daily-stats .button-small {
    padding: 0 0.5rem;
    height: 1.75rem;
    line-height: 1.625rem;
    font-size: 0.8125rem;
}

/* ======================
   Empty States
   ====================== */
.no-data {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--wpcs-text-secondary);
}

/* ======================
   Loading Animations
   ====================== */
@keyframes wpcs-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes wpcs-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.wpcs-fade-in {
    animation: wpcs-fadeIn 0.3s ease-in-out;
}

.wpcs-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,0,0,0.1);
    border-radius: 50%;
    border-top-color: var(--wpcs-primary);
    animation: wpcs-spin 1s ease-in-out infinite;
}

/* ======================
   Responsive Adjustments
   ====================== */
@media screen and (max-width: 782px) {
    .wpcs-admin {
        padding: 0 0.625rem;
    }
    
    .form-actions,
    .action-buttons {
        flex-direction: column;
        gap: 0.625rem;
    }
    
    .form-actions .button,
    .action-buttons .button {
        width: 100%;
        text-align: center;
    }
    
    .short-url-display {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* ======================
   High Contrast Mode
   ====================== */
@media screen and (forced-colors: active) {
    .checkmark {
        forced-color-adjust: none;
        border-color: ButtonText;
    }
    .checkbox-container input:checked ~ .checkmark {
        background-color: Highlight;
    }
}

/* ======================
   Print Styles
   ====================== */
@media print {
    .wpcs-header, 
    .form-actions, 
    .analytics-actions {
        display: none;
    }
    
    .wpcs-card {
        border: none;
        box-shadow: none;
        padding: 0;
    }
    
    .no-data {
        display: none;
    }
}