/* Get colors from theme */
:root {
    --afb-primary-color: var(--wp--preset--color--primary, #2c3e50);
    --afb-secondary-color: var(--wp--preset--color--secondary, #3498db);
    --afb-accent-color: var(--wp--preset--color--accent, #e74c3c);
    --afb-light-color: var(--wp--preset--color--light, #ecf0f1);
    --afb-dark-color: var(--wp--preset--color--dark, #2c3e50);
    --afb-success-color: var(--wp--preset--color--success, #27ae60);
    --afb-warning-color: var(--wp--preset--color--warning, #f39c12);
}
.afb-stat-number {
    color: #fff;
    line-height: 1;
    font-size: 2.5em;
    display: inline-block;
}
.afb-stat-container {
    font-family: var(--wp--preset--font-family--tajawal, 'Tajawal', sans-serif);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #333;
    line-height: 1.6;
    padding: 20px;
    max-width: 1600px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.afb-stat-header {
    background: linear-gradient(to right, var(--afb-primary-color), var(--afb-secondary-color));
    color: white;
    padding: 30px;
    text-align: center;
    position: relative;
}

.afb-stat-header h1 { 
    font-size: 2.8rem; 
    margin-bottom: 10px; 
}

.afb-stat-header p { 
    font-size: 1.2rem; 
    opacity: 0.9; 
}

/* Stats Grid */
.afb-stat-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.afb-stat-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    border-top: 5px solid var(--afb-secondary-color);
    transition: all 0.3s ease;
    text-align: center;
}

.afb-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.afb-stat-icon {
    font-size: 2.2rem;
    color: var(--afb-secondary-color);
    margin-bottom: 15px;
}

.afb-stat-title {
    color: var(--afb-dark-color);
    font-size: 1rem;
    margin-bottom: 15px;
    font-weight: 600;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.afb-stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--afb-primary-color);
    margin: 20px 0;
}

.afb-stat-subtitle {
    color: #7f8c8d;
    font-size: 0.8rem;
    margin-top: 10px;
}

/* College Stats */
.afb-stat-college-section {
    margin-top: 40px;
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
}

.afb-stat-college-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.afb-stat-college-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border-left: 4px solid var(--afb-secondary-color);
}

.afb-stat-college-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.afb-stat-college-header {
    border-bottom: 2px solid var(--afb-light-color);
    padding-bottom: 15px;
    margin-bottom: 15px;
    text-align: center;
}

.afb-stat-college-name {
    font-weight: bold;
    color: var(--afb-dark-color);
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.afb-stat-college-code {
    background: var(--afb-secondary-color);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: inline-block;
    margin-bottom: 10px;
}

.afb-stat-college-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.afb-stat-college-item {
    text-align: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.afb-stat-college-label { 
    color: #666; 
    font-size: 0.85rem; 
    margin-bottom: 5px; 
    display: block;
}

.afb-stat-college-number { 
    color: var(--afb-primary-color); 
    font-size: 1.2rem; 
    font-weight: bold; 
}

/* Departments Cards */
.afb-stat-departments-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 25px;
}

.afb-stat-department-card {
    background: linear-gradient(135deg, var(--afb-primary-color), var(--afb-secondary-color));
    color: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    transition: transform .3s ease, box-shadow .3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
}

.afb-stat-department-card::before {
    content: "\f51c";
    font-family: "Font Awesome 5 Free"; 
    font-weight: 900;
    position: absolute;
    font-size: 5rem;
    color: rgba(255,255,255,0.15);
    top: 10px;
    right: 15px;
    z-index: 1;
    pointer-events: none;
}

.afb-stat-department-card::after {
    content: "";
    position: absolute;
    top: -40%;
    right: -40%;
    width: 120%;
    height: 120%;
    background: rgba(255,255,255,0.08);
    transform: rotate(25deg);
}

.afb-stat-department-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 35px rgba(0,0,0,0.25);
}

.afb-stat-department-header {
    font-size: 1.05rem;
    font-weight: 700;
    position: relative;
    z-index: 2;
    margin-bottom: 15px;
}

.afb-stat-department-footer {
    text-align: right;
    position: relative;
    z-index: 2;
}

.afb-stat-department-value {
    font-size: 2rem;
    font-weight: 800;
}

.afb-stat-department-label {
    font-size: .85rem;
    opacity: .9;
}

/* Formatted IDs Styles */
.afb-stat-formatted-id {
    background: var(--afb-secondary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-family: monospace;
    font-size: 0.9em;
    font-weight: bold;
    margin: 0 3px;
}

.afb-stat-alt-id {
    color: #666;
    font-size: 0.85em;
    margin-right: 8px;
}

[dir="rtl"] .afb-stat-alt-id {
    margin-right: 0;
    margin-left: 8px;
}

.afb-stat-college-id-container {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 80px;
}

.afb-stat-input-id {
    background: #ffc107;
    color: #000;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.8em;
    margin-right: 5px;
}

.afb-stat-college-id-display,
.afb-stat-dept-id-display {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
    display: block;
}

.afb-stat-shortcode-examples code {
    display: inline-block;
    margin: 2px 0;
    background: #f1f3f4;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-family: 'Courier New', monospace;
}

/* Dynamic Shortcodes Styles */
.afb-stat-colleges-list,
.afb-stat-college-departments {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
}

.afb-stat-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.afb-stat-table th {
    background: var(--afb-primary-color);
    color: white;
    padding: 12px 15px;
    text-align: right;
    font-weight: 600;
}

.afb-stat-table td {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
}

.afb-stat-table tr:hover {
    background: #f5f7fa;
}

.afb-stat-colleges-ul {
    list-style: none;
    padding: 0;
}

.afb-stat-colleges-ul li {
    padding: 10px 15px;
    margin: 5px 0;
    background: white;
    border-radius: 6px;
    border-right: 4px solid var(--afb-secondary-color);
    display: flex;
    align-items: center;
    gap: 15px;
}

.afb-stat-colleges-ul li strong {
    min-width: 40px;
    text-align: center;
    background: var(--afb-secondary-color);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
}

.afb-stat-colleges-ul li small {
    margin-right: auto;
    font-size: 0.9em;
    color: #666;
}

.afb-stat-college-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.afb-stat-college-card-small {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.afb-stat-college-card-small:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.afb-stat-college-card-id {
    background: var(--afb-primary-color);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2em;
    margin: 0 auto 10px;
}

.afb-stat-college-card-name {
    text-align: center;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--afb-dark-color);
}

.afb-stat-college-card-shortcode {
    text-align: center;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.85em;
}

.afb-stat-college-card-alt-shortcode {
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px dashed #ddd;
}

.afb-stat-note {
    background: #e7f3ff;
    border-right: 4px solid #4dabf7;
    padding: 12px 15px;
    border-radius: 6px;
    margin-top: 20px;
    font-size: 0.9em;
    color: #1864ab;
}

.afb-stat-note i {
    color: #4dabf7;
    margin-left: 8px;
}

.afb-stat-department-ids {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.afb-stat-department-codes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.afb-stat-department-code-item {
    background: var(--afb-light-color);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    border: 1px solid #dee2e6;
}

.afb-stat-department-id {
    background: var(--afb-secondary-color);
    color: white;
    font-size: 0.8em;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 10px;
    font-weight: bold;
}

[dir="rtl"] .afb-stat-department-id {
    margin-left: 0;
    margin-right: 10px;
}

/* Additional CSS for new templates */
.afb-stat-summary-info {
    background: linear-gradient(to right, #f9d69f, #f9d69c);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    border-left: 5px solid var(--afb-success-color);
}

.afb-stat-summary-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
}

.afb-stat-summary-item {
    flex: 1;
    min-width: 200px;
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.afb-stat-summary-label {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 5px;
    display: block;
}

.afb-stat-summary-value {
    color: var(--afb-primary-color);
    font-size: 1.5rem;
    font-weight: bold;
}

.afb-stat-majors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.afb-stat-major-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    border-top: 4px solid var(--afb-secondary-color);
}

.afb-stat-major-icon {
    font-size: 2rem;
    color: var(--afb-secondary-color);
    margin-bottom: 15px;
}

.afb-stat-major-title {
    color: var(--afb-dark-color);
    font-size: 1.1rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.afb-stat-major-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--afb-primary-color);
}

.afb-stat-department-details {
    margin: 30px 0;
}

.afb-stat-department-card-large {
    background: linear-gradient(135deg, var(--afb-primary-color), var(--afb-secondary-color));
    color: white;
    border-radius: 15px;
    padding: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    align-items: center;
}

.afb-stat-department-info {
    flex: 2;
}

.afb-stat-department-field {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.afb-stat-department-label {
    display: inline-block;
    width: 150px;
    font-weight: 600;
}

.afb-stat-department-value {
    display: inline-block;
    font-weight: 500;
}

.afb-stat-department-stats {
    flex: 1;
}

.afb-stat-department-stat-card {
    text-align: center;
    padding: 20px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

.afb-stat-department-stat-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.afb-stat-department-stat-title {
    font-size: 1rem;
    margin-bottom: 10px;
    opacity: 0.9;
}

.afb-stat-department-stat-value {
    font-size: 2.5rem;
    font-weight: bold;
}

.afb-stat-error {
    background: #fee;
    border: 1px solid #f99;
    color: #c00;
    padding: 20px;
    border-radius: 5px;
    text-align: center;
    margin: 20px 0;
    font-size: 1.1rem;
}

.afb-stat-no-data {
    text-align: center;
    padding: 60px 20px;
    background: #f5f5f5;
    border-radius: 10px;
    color: #666;
}

.afb-stat-no-data i {
    font-size: 4rem;
    color: #999;
    margin-bottom: 20px;
}

.afb-stat-no-data h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.afb-stat-no-data p {
    font-size: 1rem;
    opacity: 0.8;
}

.afb-stat-section-title {
    color: var(--afb-primary-color);
    margin: 40px 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--afb-secondary-color);
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 15px;
}

.afb-stat-section-title i { 
    color: var(--afb-secondary-color); 
}

.afb-stat-footer {
    text-align: center;
    padding: 25px;
    background: var(--afb-light-color);
    color: var(--afb-dark-color);
    border-top: 1px solid #ddd;
    margin-top: 30px;
}

.afb-stat-update-time { 
    font-size: 0.9rem; 
    color: #7f8c8d; 
    margin-bottom: 10px;
}

/* Responsive */
@media (max-width: 1200px) { 
    .afb-stat-grid { grid-template-columns: repeat(4, 1fr); } 
}

@media (max-width: 992px) {
    .afb-stat-grid { grid-template-columns: repeat(3, 1fr); }
    .afb-stat-college-grid { grid-template-columns: repeat(2, 1fr); }
    .afb-stat-departments-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .afb-stat-header h1 { font-size: 2rem; }
    .afb-stat-grid, 
    .afb-stat-college-grid, 
    .afb-stat-departments-cards { 
        grid-template-columns: 1fr; 
    }
    .afb-stat-college-stats { grid-template-columns: 1fr; }
    .afb-stat-summary-grid { flex-direction: column; }
    .afb-stat-stat-value { font-size: 2rem; }
    .afb-stat-department-card-large { flex-direction: column; }
    .afb-stat-college-id-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
    }
    .afb-stat-formatted-id {
        font-size: 0.85em;
        padding: 1px 6px;
    }
}

/* Stat Colors */
.afb-stat-card:nth-child(1) { border-top-color: #e74c3c; }
.afb-stat-card:nth-child(2) { border-top-color: #2ecc71; }
.afb-stat-card:nth-child(3) { border-top-color: #3498db; }
.afb-stat-card:nth-child(4) { border-top-color: #9b59b6; }
.afb-stat-card:nth-child(5) { border-top-color: #f1c40f; }
.afb-stat-card:nth-child(6) { border-top-color: #1abc9c; }
.afb-stat-card:nth-child(7) { border-top-color: #d35400; }
.afb-stat-card:nth-child(8) { border-top-color: #34495e; }
.afb-stat-card:nth-child(9) { border-top-color: #16a085; }
.afb-stat-card:nth-child(10) { border-top-color: #8e44ad; }

/* College Colors */
.afb-stat-college-card:nth-child(1) { border-left-color: #e74c3c; }
.afb-stat-college-card:nth-child(2) { border-left-color: #2ecc71; }
.afb-stat-college-card:nth-child(3) { border-left-color: #3498db; }
.afb-stat-college-card:nth-child(4) { border-left-color: #9b59b6; }
.afb-stat-college-card:nth-child(5) { border-left-color: #f1c40f; }
.afb-stat-college-card:nth-child(6) { border-left-color: #1abc9c; }
.afb-stat-college-card:nth-child(7) { border-left-color: #d35400; }

/*الارقام المنفردة*/

/* ============================================ */
/* Single Stat Cards - جديد */
/* ============================================ */

.afb-stat-single-card {
    max-width: 400px;
    margin: 20px auto;
    animation: fadeInUp 0.6s ease-out;
}

.afb-stat-single-card .afb-stat-card {
    cursor: default;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.afb-stat-single-card .afb-stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.afb-stat-single-card .afb-stat-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 25px 40px rgba(0, 0, 0, 0.15);
}

.afb-stat-single-card .afb-stat-card:hover::before {
    opacity: 1;
}

.afb-stat-single-card .afb-stat-icon {
    font-size: 2.5rem;
    transition: transform 0.3s ease;
}

.afb-stat-single-card .afb-stat-card:hover .afb-stat-icon {
    transform: scale(1.1);
}

.afb-stat-single-card .afb-stat-title {
    font-size: 1.1rem;
    min-height: 60px;
    padding: 0 10px;
}

.afb-stat-single-card .afb-stat-value {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--afb-primary-color), var(--afb-secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s ease;
}

.afb-stat-single-card .afb-stat-card:hover .afb-stat-value {
    transform: scale(1.05);
}

.afb-stat-single-footer {
    text-align: center;
    margin-top: 10px;
    color: #666;
    font-size: 0.9rem;
}

.afb-stat-single-footer a {
    color: var(--afb-secondary-color);
    text-decoration: none;
    border-bottom: 1px dashed;
    transition: color 0.3s ease;
}

.afb-stat-single-footer a:hover {
    color: var(--afb-primary-color);
}

.afb-stat-college-code-badge {
    display: inline-block;
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.1), rgba(52, 152, 219, 0.2));
    color: var(--afb-secondary-color);
    padding: 4px 15px;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 10px;
    border: 1px solid rgba(52, 152, 219, 0.2);
}

/* Animation for single cards */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card entrance delays */
.afb-stat-single-card:nth-child(1) { animation-delay: 0.1s; }
.afb-stat-single-card:nth-child(2) { animation-delay: 0.2s; }
.afb-stat-single-card:nth-child(3) { animation-delay: 0.3s; }
.afb-stat-single-card:nth-child(4) { animation-delay: 0.4s; }
.afb-stat-single-card:nth-child(5) { animation-delay: 0.5s; }

/* Number animation pulse */
@keyframes numberPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.afb-stat-single-card .afb-stat-value.animating {
    animation: numberPulse 0.5s ease-in-out;
}

/* RTL Support for single cards */
[dir="rtl"] .afb-stat-single-card {
    text-align: center;
}

[dir="rtl"] .afb-stat-single-footer {
    text-align: center;
}

/* Responsive for single cards */
@media (max-width: 768px) {
    .afb-stat-single-card {
        max-width: 100%;
        padding: 0 15px;
    }
    
    .afb-stat-single-card .afb-stat-value {
        font-size: 2.5rem;
    }
    
    .afb-stat-single-card .afb-stat-title {
        font-size: 1rem;
        min-height: 50px;
    }
}

@media (max-width: 480px) {
    .afb-stat-single-card .afb-stat-value {
        font-size: 2rem;
    }
}