/* ============================================
   REISHI COFFEE - ADMIN PANEL CSS
   ============================================ */

/* ---- ADMIN LAYOUT ---- */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
    background: var(--gray-100);
}

/* ---- SIDEBAR ---- */
.admin-sidebar {
    width: 260px;
    background: var(--dark);
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: width 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header img {
    height: 35px;
}

.sidebar-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.sidebar-header small {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.5);
    display: block;
}

.sidebar-menu {
    padding: 10px 0;
}

/* ---- COLLAPSIBLE GROUPS ---- */
.sidebar-group {
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sidebar-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    color: rgba(255,255,255,0.55);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.sidebar-group-header:hover {
    color: var(--white);
    background: rgba(255,255,255,0.04);
}

.sidebar-group-header span {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-group-header span i {
    width: 20px;
    text-align: center;
    font-size: 0.9rem;
}

.group-arrow {
    font-size: 0.6rem;
    transition: transform 0.3s ease;
    opacity: 0.5;
}

.sidebar-group.open .group-arrow {
    transform: rotate(180deg);
    opacity: 1;
}

.sidebar-group-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    background: rgba(0,0,0,0.12);
}

.sidebar-group.open .sidebar-group-items {
    max-height: 500px;
}

.sidebar-group-items .sidebar-link {
    padding-left: 50px;
    font-size: 0.85rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: rgba(255,255,255,0.65);
    font-size: 0.9rem;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    color: var(--white);
    background: rgba(255,255,255,0.05);
}

.sidebar-link.active {
    color: var(--white);
    background: rgba(45,106,79,0.3);
    border-left-color: var(--primary-light);
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
}

/* ---- MAIN CONTENT ---- */
.admin-main {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* ---- TOP BAR ---- */
.admin-topbar {
    background: var(--white);
    padding: 15px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 110;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    width: 38px;
    height: 38px;
    font-size: 1.15rem;
    cursor: pointer;
    color: var(--gray-700);
    border-radius: 10px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: relative;
    z-index: 120;
}

.sidebar-toggle:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(45,106,79,0.25);
}

/* ---- SIDEBAR COLLAPSE BUTTON ---- */
.sidebar-collapse-btn {
    position: absolute;
    top: 30px;
    right: -13px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    border: 2px solid var(--gray-100);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    z-index: 110;
    transition: all 0.3s ease;
    opacity: 0;
}

.admin-sidebar:hover .sidebar-collapse-btn,
.sidebar-collapse-btn:focus {
    opacity: 1;
}

.sidebar-collapsed .sidebar-collapse-btn {
    opacity: 1;
    transform: rotate(180deg);
}

/* ---- SIDEBAR COLLAPSED STATE ---- */
.sidebar-collapsed .admin-sidebar {
    width: 70px;
}

.sidebar-collapsed .admin-main {
    margin-left: 70px;
}

.sidebar-collapsed .sidebar-header-text {
    display: none;
}

.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding: 20px 10px;
}

.sidebar-collapsed .sidebar-header img {
    height: 28px;
}

.sidebar-collapsed .sidebar-group-header .link-text,
.sidebar-collapsed .sidebar-group-header .group-arrow {
    display: none;
}

.sidebar-collapsed .sidebar-group-header {
    justify-content: center;
    padding: 13px 10px;
}

.sidebar-collapsed .sidebar-group-items {
    max-height: 0 !important;
}

.sidebar-collapsed .sidebar-group {
    border-bottom: none;
}

.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: 13px 10px;
    position: relative;
}

.sidebar-collapsed .sidebar-link .link-text {
    display: none;
}

.sidebar-collapsed .sidebar-link i {
    font-size: 1.1rem;
    width: auto;
}

.sidebar-collapsed .sidebar-link:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 75px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--dark);
    color: var(--white);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 200;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    pointer-events: none;
}

.sidebar-collapsed .sidebar-link:hover::before {
    content: '';
    position: absolute;
    left: 67px;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: var(--dark);
    z-index: 200;
}

.topbar-title h2 {
    font-size: 1.2rem;
    color: var(--dark);
    font-weight: 700;
}

.topbar-title p {
    font-size: 0.8rem;
    color: var(--gray-600);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius);
    transition: var(--transition);
}

.topbar-user:hover {
    background: var(--gray-100);
}

.topbar-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

/* ---- ADMIN CONTENT ---- */
.admin-content {
    padding: 30px;
    flex: 1;
}

/* ---- STAT CARDS ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
    border: 1px solid var(--gray-200);
}

.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-3px);
}

.stat-icon {
    width: 55px;
    height: 55px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-icon.green { background: rgba(45,106,79,0.1); color: var(--primary); }
.stat-icon.blue { background: rgba(23,162,184,0.1); color: var(--info); }
.stat-icon.orange { background: rgba(212,165,116,0.1); color: var(--secondary-dark); }
.stat-icon.red { background: rgba(220,53,69,0.1); color: var(--danger); }

.stat-info h3 {
    font-size: 1.6rem;
    color: var(--dark);
    font-weight: 800;
    line-height: 1;
}

.stat-info p {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-top: 4px;
}

/* ---- TABLES ---- */
.admin-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    margin-bottom: 25px;
}

.admin-card-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-card-header h3 {
    font-size: 1.05rem;
    color: var(--dark);
}

.admin-card-body {
    padding: 25px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table thead th {
    background: var(--gray-100);
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-200);
}

.admin-table tbody td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--gray-200);
    vertical-align: middle;
}

.admin-table tbody tr:hover {
    background: var(--gray-100);
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

/* ---- BADGES ---- */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-primary { background: rgba(45,106,79,0.1); color: var(--primary); }
.badge-secondary { background: var(--gray-200); color: var(--gray-700); }

/* ---- FORMS (Admin) ---- */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-700);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    color: var(--gray-800);
    transition: var(--transition);
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(45,106,79,0.1);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

/* ---- ADMIN AUTH ---- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark), var(--dark));
    padding: 20px;
}

.auth-card {
    background: var(--white);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 420px;
}

.auth-card .auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-card .auth-logo img {
    height: 50px;
    margin: 0 auto 10px;
}

.auth-card .auth-logo h2 {
    font-size: 1.3rem;
    color: var(--dark);
}

.auth-card .auth-logo p {
    font-size: 0.85rem;
    color: var(--gray-600);
}

/* ---- RESPONSIVE ADMIN ---- */
@media (max-width: 992px) {
    .admin-sidebar {
        transform: translateX(-100%);
        width: 260px !important;
    }

    .admin-sidebar.active {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0 !important;
    }

    .sidebar-collapse-btn {
        display: none !important;
    }

    /* Always show text on mobile */
    .sidebar-link .link-text,
    .sidebar-group-header .link-text {
        display: inline !important;
    }

    .sidebar-group-header .group-arrow {
        display: inline !important;
    }

    .sidebar-group-items {
        max-height: none !important;
    }

    .sidebar-group.open .sidebar-group-items {
        max-height: 500px !important;
    }

    .sidebar-header-text {
        display: block !important;
    }
}

@media (max-width: 768px) {
    .admin-content {
        padding: 15px;
    }

    .admin-topbar {
        padding: 12px 15px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-table {
        display: block;
        overflow-x: auto;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ---- IMAGE UPLOAD PREVIEW ---- */
.image-upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.image-upload-area:hover {
    border-color: var(--primary);
    background: rgba(45,106,79,0.02);
}

.image-upload-area input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.image-upload-area i {
    font-size: 2rem;
    color: var(--gray-400);
    margin-bottom: 10px;
}

.image-preview {
    max-width: 200px;
    max-height: 200px;
    margin: 10px auto;
    border-radius: var(--radius);
}

/* ---- ACTION BUTTONS ---- */
.action-btns {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: var(--transition);
}

.action-btn.edit {
    background: rgba(23,162,184,0.1);
    color: var(--info);
}

.action-btn.edit:hover {
    background: var(--info);
    color: var(--white);
}

.action-btn.delete {
    background: rgba(220,53,69,0.1);
    color: var(--danger);
}

.action-btn.delete:hover {
    background: var(--danger);
    color: var(--white);
}

.action-btn.view {
    background: rgba(45,106,79,0.1);
    color: var(--primary);
}

.action-btn.view:hover {
    background: var(--primary);
    color: var(--white);
}

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--gray-600);
}

.empty-state i {
    font-size: 3rem;
    opacity: 0.2;
    margin-bottom: 15px;
}

.empty-state p {
    font-size: 1rem;
}

/* ---- PAGINATION ---- */
.pagination {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-top: 20px;
}

.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
    transition: var(--transition);
}

.pagination a:hover {
    background: var(--gray-100);
}

.pagination .active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}
