/* ===============================*
 *   ESTI Pro – Frontend UI Kit
 * ===============================*/

/* Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.esti-frontend {
    background: #f5f7fa;
    font-family: "Inter", Arial, sans-serif;
}

/* Layout */
.esti-wrapper {
    max-width: 1250px;
    margin: 40px auto;
    padding: 0 20px;
}

/* Headline */
.esti-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 25px;
    color: #111827;
}

/* Tabs */
.esti-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 10px;
}

.esti-tab {
    padding: 10px 20px;
    font-size: 15px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    color: #374151;
    transition: 0.2s;
}

.esti-tab:hover {
    background: #f3f4f6;
}

.esti-tab.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

/* Cards */
.esti-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 25px;
}

.esti-card h3 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #1f2937;
}

.esti-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.esti-box {
    padding: 20px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.esti-box .value {
    font-size: 30px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 5px;
}

/* Table */
.esti-table {
    width: 100%;
    border-collapse: collapse;
}

.esti-table th {
    background: #f9fafb;
    padding: 12px;
    font-size: 13px;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.esti-table td {
    padding: 14px;
    border-bottom: 1px solid #f3f4f6;
}

.esti-table tr:hover td {
    background: #f9fafb;
}

/* Status Pills */
.esti-status {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.esti-status.success { background: #10b981; }
.esti-status.warning { background: #f59e0b; }
.esti-status.error   { background: #ef4444; }

/* Inputs */
.esti-input {
    width: 100%;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    font-size: 14px;
}

.esti-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37,99,235,0.2);
    outline: none;
}

/* Buttons */
.esti-btn {
    display: inline-block;
    padding: 12px 20px;
    background: #2563eb;
    color: #fff;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    transition: 0.2s;
}

.esti-btn:hover {
    background: #1d4ed8;
}

.esti-btn.outlined {
    background: #fff;
    border: 1px solid #2563eb;
    color: #2563eb;
}

.esti-btn.outlined:hover {
    background: #2563eb;
    color: #fff;
}

/* Loader */
.esti-loader {
    display: none;
    margin: 20px auto;
    border: 4px solid #eee;
    border-top: 4px solid #2563eb;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.esti-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
}

.esti-tab-btn {
    padding: 10px 16px;
    border-radius: 6px;
    background: #f3f4f6;
    cursor: pointer;
}

.esti-tab-btn.active {
    background: #2563eb;
    color: #fff;
}

.esti-tab-section {
    display: none;
}
/* ... (Останалата част от frontend.css) ... */

/* ============================================================
 * НОВИ СТИЛОВЕ ЗА DASHBOARD
 * ============================================================ */

.esti-kpi-grid {
    display: grid;
    /* 4 колони за десктоп */
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

@media (max-width: 1024px) {
    /* 2 колони за таблет */
    .esti-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.esti-kpi-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.esti-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.esti-kpi-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 5px;
    display: block;
}

.esti-kpi-label {
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
}

/* ЦВЕТОВЕ НА КАРТИТЕ */
.esti-kpi-card.blue { border-left: 5px solid #2563eb; }
.esti-kpi-card.purple { border-left: 5px solid #9333ea; }
.esti-kpi-card.green { border-left: 5px solid #10b981; }
.esti-kpi-card.orange { border-left: 5px solid #f59e0b; }

/* Styles for the error card */
.esti-card.error {
    border-left: 5px solid #ef4444;
    background-color: #fee2e2;
}

.esti-card.error h3 {
    color: #991b1b;
}

/* EXISTING styles for esti-table should handle the tables correctly */

/* ============================================================
 * СТИЛОВЕ ЗА ТАБЛИЦИ И МЕТА ДАННИ
 * ============================================================ */

.esti-table.esti-modern-table {
    border-collapse: collapse;
    width: 100%;
}

.esti-table.esti-modern-table th {
    background-color: #f9fafb;
    color: #6b7280;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    padding: 12px 15px;
    border-bottom: 1px solid #e5e7eb;
}

.esti-table.esti-modern-table td {
    padding: 15px;
    font-size: 14px;
    color: #1f2937;
    border-bottom: 1px solid #f3f4f6;
}

.esti-table.esti-modern-table tbody tr:last-child td {
    border-bottom: none;
}

.esti-meta {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 3px;
}

/* Status Badges */
.esti-status {
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.esti-status.success { background-color: #d1fae5; color: #065f46; } /* Green */
.esti-status.warning { background-color: #fef3c7; color: #92400e; } /* Orange */
.esti-status.error { background-color: #fee2e2; color: #991b1b; } /* Red */