/* Admin Styles */
/* Dashboard widget beautify */
.dm7-widget {
    margin-top: 5px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.dm7-sections { 
    display: flex; 
    flex-direction: column; 
    gap: 16px; 
}

.dm7-section { 
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border: 1px solid #e0e0e0; 
    border-radius: 12px; 
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.dm7-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.dm7-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #00a32a 0%, #007a3d 50%, #005a2a 100%);
    opacity: 0.8;
}

.dm7-section:nth-child(2)::before {
    background: linear-gradient(90deg, #2271b1 0%, #1658a0 50%, #0f3f6f 100%);
}

.dm7-section:nth-child(3)::before {
    background: linear-gradient(90deg, #d63638 0%, #b32d2e 50%, #8b1f20 100%);
}

.dm7-section-header { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    margin-bottom: 16px;
}

.dm7-section-title { 
    font-weight: 700;
    font-size: 16px;
    color: #1d2327;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dm7-icon { 
    font-size: 20px; 
    width: 20px; 
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dm7-icon-green { 
    color: #00a32a; 
    background: rgba(0, 163, 42, 0.1);
    border-radius: 50%;
    padding: 8px;
}

.dm7-icon-blue { 
    color: #2271b1; 
    background: rgba(34, 113, 177, 0.1);
    border-radius: 50%;
    padding: 8px;
}

.dm7-icon-red { 
    color: #d63638; 
    background: rgba(214, 54, 56, 0.1);
    border-radius: 50%;
    padding: 8px;
}

.dm7-pair-row { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 16px; 
}

.dm7-card {
    flex: 1 1 200px;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border: 2px solid #e0e0e0;
    border-left-width: 6px;
    border-radius: 12px;
    padding: 20px 18px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    position: relative;
}

.dm7-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.dm7-card-blue { 
    border-left-color: #2271b1;
    background: linear-gradient(135deg, #f0f6fc 0%, #ffffff 100%);
}

.dm7-card-green { 
    border-left-color: #00a32a;
    background: linear-gradient(135deg, #f0f9f4 0%, #ffffff 100%);
}

.dm7-card-value {
    font-size: 28px;
    font-weight: 800;
    color: #1d2327;
    line-height: 1.2;
    margin-bottom: 8px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.dm7-card-title {
    font-size: 13px;
    color: #646970;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Badge styles for counts - Improved Design */
.dm7-badge { 
    color: #ffffff; 
    font-weight: 700; 
    padding: 12px 20px; 
    border-radius: 25px; 
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-align: center;
    min-height: 20px;
}

.dm7-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.6s ease;
}

.dm7-badge:hover::before {
    left: 100%;
}

.dm7-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.dm7-badge strong { 
    color: #ffffff; 
    font-weight: 800;
    font-size: 16px;
}

.dm7-badge-green { 
    background: linear-gradient(135deg, #00a32a 0%, #007a3d 100%);
    border: 2px solid rgba(0, 163, 42, 0.3);
}

.dm7-badge-blue { 
    background: linear-gradient(135deg, #2271b1 0%, #1658a0 100%);
    border: 2px solid rgba(34, 113, 177, 0.3);
}

.dm7-badge-red { 
    background: linear-gradient(135deg, #d63638 0%, #b32d2e 100%);
    border: 2px solid rgba(214, 54, 56, 0.3);
}

/* Animation for numbers */
@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.dm7-badge strong {
    animation: countUp 0.6s ease-out;
}

/* Responsive Design */
@media (max-width: 782px) {
    .dm7-pair-row { 
        grid-template-columns: 1fr; 
        gap: 12px;
    }
    
    .dm7-sections {
        gap: 12px;
    }
    
    .dm7-section {
        padding: 12px;
    }
    
    .dm7-section-title {
        font-size: 14px;
    }
    
    .dm7-badge {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .dm7-badge strong {
        font-size: 15px;
    }
    
    .dm7-icon {
        padding: 6px;
        font-size: 18px;
    }
}

#edit-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-modal-content {
    background: white;
    padding: 20px;
    border-radius: 5px;
    min-width: 400px;
}

.download-link-item {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #f9f9f9;
}

.download-fields {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: end;
}

.field-group {
    display: flex;
    flex-direction: column;
}

.field-group label {
    font-weight: bold;
    margin-bottom: 5px;
}

.url-field {
    width: 45%;
}

.name-field {
    width: 35%;
}

.url-field input,
.name-field input {
    width: 100%;
    box-sizing: border-box;
}

.remove-link {
    flex-shrink: 0;
}

/* Admin page improvements */
.dm-admin-header {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.04);
}

.dm-admin-header h1 {
    margin: 0 0 10px 0;
    color: #1d2327;
}

.dm-admin-header p {
    margin: 0;
    color: #646970;
}

.dm-search-container {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.04);
}

.dm-search-box {
    display: flex;
    gap: 10px;
    align-items: center;
}

.dm-search-box input[type="text"] {
    flex: 1;
    max-width: 300px;
    padding: 8px 12px;
    border: 1px solid #8c8f94;
    border-radius: 3px;
    height: 30px; /* Äáº·t chiá»u cao cá»' Ä'á»‹nh */
    box-sizing: border-box;
}

.dm-search-box .button {
    margin-left: 5px;
    height: 30px; /* Äáº·t chiá»u cao báº±ng input */
    line-height: 28px; /* CÄƒn chá»‰nh text trong nÃºt */
    padding: 0 12px;
}

.dm-stats {
    display: flex;
    gap: 20px;
    margin-top: 15px;
}

.dm-stat-item {
    padding: 10px 15px;
    background: #f6f7f7;
    border-radius: 3px;
    border-left: 4px solid #00a32a;
}

.dm-stat-item strong {
    display: block;
    font-size: 18px;
    color: #1d2327;
}

.dm-stat-item span {
    color: #646970;
    font-size: 13px;
}

.dm-table-container {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.04);
}

.dm-table-container table {
    margin: 0;
    border-radius: 4px;
}

.dm-table-container .wp-list-table th {
    background: #f6f7f7;
    border-bottom: 1px solid #c3c4c7;
    font-weight: 600;
    color: #1d2327;
}

.dm-table-container .wp-list-table td {
    vertical-align: middle;
}

.dm-link-preview {
    max-width: 300px;
    word-break: break-all;
    color: #2271b1;
    text-decoration: none;
}

.dm-link-preview:hover {
    text-decoration: underline;
}

.dm-filename {
    font-weight: 500;
    color: #1d2327;
}

.dm-download-count {
    background: #f0f6fc;
    color: #0073aa;
    padding: 4px 8px;
    border-radius: 3px;
    font-weight: 500;
    display: inline-block;
}

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

.dm-actions .button {
    padding: 4px 8px;
    font-size: 12px;
    height: auto;
}

.dm-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #646970;
}

.dm-empty-state .dashicons {
    font-size: 48px;
    color: #c3c4c7;
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    /* Cho phÃ©p cuá»™n ngang báº£ng trÃªn mobile náº¿u rá»™ng hÆ¡n mÃ n hÃ¬nh */
    .dm-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }
    .dm-table-container table {
        min-width: 720px; /* Äáº·t chiá»u rá»™ng tá»'i thiá»ƒu Ä'á»ƒ cÃ³ thanh cuá»™n khi cáº§n */
    }

    /* áº¨n cá»™t Link (100 kÃ½ tá»± Ä'áº§u) trÃªn mobile trong báº£ng admin */
    .dm-table-container table.wp-list-table thead th:nth-child(3),
    .dm-table-container table.wp-list-table tbody td:nth-child(3) {
        display: none;
    }

    .download-fields {
        flex-direction: column;
        gap: 15px;
    }
    
    .url-field {
        width: 100%;
    }
    
    .name-field {
        width: 100%;
    }
    
    .remove-link {
        width: 25%;
    }
    
    /* Äáº£m báº£o má»—i pháº§n tá»­ á»Ÿ má»™t dÃ²ng riÃªng */
    .mobile-row {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .dm-search-box {
        flex-direction: column;
        align-items: stretch;
    }
    
    .dm-search-box input[type="text"] {
        max-width: none;
        margin-bottom: 10px;
    }
    
    .dm-search-box .button {
        height: auto; /* Tráº£ vá» chiá»u cao máº·c Ä'á»‹nh trÃªn mobile */
    }
    
    .dm-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .dm-actions {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 6px;
        white-space: nowrap;
    }
    .dm-actions .button {
        white-space: nowrap;
    }
    
    .dm-link-preview {
        max-width: none;
        font-size: 12px;
    }
}

/* Frontend Styles */
.download-links-container {
    border: 1px solid #007cba;
    border-radius: 10px;
    background-color: #f0f8ff;
    padding: 15px 8px 15px 8px;
    margin-top: 30px;
}

.download-links-title {
    margin-top: 0;
    font-weight: bold;
    color: #007cba;
}

.download-link-box {
    margin: 10px 0;
    padding: 10px;
    background: white;
    border-radius: 5px;
}

.download-link-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.download-link {
    color: #007cba;
    text-decoration: none;
    font-weight: 500;
    flex: 1;
    margin-right: 15px;
}

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

/* Styling cho container chá»©a icon vÃ  sá»' lÆ°á»£t táº£i */
.download-count-container {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #e8e8e8;
    padding: 3px 10px;
    border-radius: 5px;
    white-space: nowrap;
    font-size: 14px;
}

.download-count-container i {
    color: #666;
    font-size: 14px;
}

.download-count {
    color: #666;
    font-weight: 500;
    margin: 0;
}

/* Responsive cho mobile - Sá»­a Ä'á»•i Ä'á»ƒ tÃªn file 75% vÃ  lÆ°á»£t táº£i 25% trÃªn cÃ¹ng 1 hÃ ng */
@media (max-width: 768px) {
    .download-link-content {
        flex-direction: row; /* Thay Ä'á»•i tá»« column thÃ nh row */
        justify-content: space-between;
        align-items: center;
        flex-wrap: nowrap; /* KhÃ´ng cho xuá»'ng hÃ ng */
        gap: 10px;
    }
    
    .download-link {
        flex: 0 0 75%; /* Chiáº¿m cá»' Ä'á»‹nh 75% chiá»u rá»™ng */
        margin-right: 0;
        margin-bottom: 0;
        font-size: 14px; /* Giáº£m font size cho mobile */
        line-height: 1.3;
        word-break: break-word; /* Cho phÃ©p ngáº¯t tá»« náº¿u quÃ¡ dÃ i */
    }
    
.download-count-container {
    flex: 0 0 25%;         /* Chiáº¿m cá»' Ä'á»‹nh 25% chiá»u rá»™ng */
    font-size: 12px;       /* Giáº£m font size cho mobile */
    padding: 2px 0px;      /* Giáº£m padding */
    background: #ffffff;
    min-width: 0;          /* Cho phÃ©p thu nhá» náº¿u cáº§n */
    justify-content: center; /* CÄƒn giá»¯a ngang */
    align-items: center;     /* CÄƒn giá»¯a dá»c */
    text-align: center;      /* Äáº£m báº£o text náº±m giá»¯a */
}

    
    .download-count-container i {
        font-size: 12px;
    }
}