/* ============================================
   MatrixPrompt — CSS Fixes & Missing Styles
   Complementa o adminator.css com classes
   faltantes e responsividade mobile.
   ============================================ */

/* === Dropdown Menu === */
.dropdown-container {
    position: relative;
}
.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 50;
    min-width: 140px;
}
.dropdown-menu.show {
    display: block;
    animation: drop-in 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--t-base);
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.15s, color 0.15s;
    text-decoration: none;
}
.dropdown-item:hover {
    background-color: var(--bg-muted);
}
.dropdown-item.danger {
    color: var(--danger);
}
.dropdown-item.danger:hover {
    background-color: var(--danger-soft);
}
@keyframes drop-in {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Grid Columns Faltantes === */
.col-3  { grid-column: span 3; }
.col-4  { grid-column: span 4; }
.col-8  { grid-column: span 8; }

/* === Workspace Avatar Container (Sidebar Footer) === */
.workspace-avatar-container {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--purple));
}
.workspace-avatar-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.workspace-initials {
    color: #fff;
    font-weight: 600;
    font-size: 12.5px;
    line-height: 1;
    user-select: none;
}

/* === KPI Cards (Dashboard) === */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
    animation: rise-in 600ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
    animation-delay: 120ms;
}
.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
    transition: transform 200ms ease, box-shadow 200ms ease;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.kpi-card::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 0 0 14px 14px;
}
.kpi-card.c-primary::after { background: var(--primary); }
.kpi-card.c-success::after { background: var(--success); }
.kpi-card.c-purple::after  { background: var(--purple); }
.kpi-card.c-danger::after  { background: var(--danger); }

.kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.kpi-identity {
    display: flex;
    align-items: center;
    gap: 12px;
}
.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.kpi-icon svg {
    width: 20px;
    height: 20px;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.kpi-icon.primary { background: var(--primary-soft); color: var(--primary); }
.kpi-icon.success { background: var(--success-soft); color: var(--success); }
.kpi-icon.purple  { background: var(--purple-soft);  color: var(--purple);  }
.kpi-icon.danger  { background: var(--danger-soft);  color: var(--danger);  }

.kpi-label {
    font-family: "JetBrains Mono", monospace;
    font-size: 10.5px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--t-light);
    font-weight: 500;
}
.kpi-value {
    font-family: "Inter Tight", "Inter", sans-serif;
    font-weight: 800;
    font-size: 32px;
    letter-spacing: -0.03em;
    color: var(--t-base);
    line-height: 1;
}
.kpi-compare {
    font-size: 12px;
    color: var(--t-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* === Topbar Avatar com Imagem === */
.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* === Responsive: Tablet (≤1024px) === */
@media (max-width: 1024px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid > .col-8 {
        grid-column: span 12;
    }
    .grid > .col-4 {
        grid-column: span 12;
    }
}

/* === Responsive: Mobile (≤768px) === */
@media (max-width: 768px) {
    .shell {
        grid-template-columns: 1fr;
    }
    .d-sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 264px;
        z-index: 100;
        transition: left 280ms cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }
    body.has-drawer-open .d-sidebar {
        left: 0;
        box-shadow: var(--shadow-lg);
    }
    .hamburger {
        display: inline-flex !important;
    }
    .d-topbar {
        padding: 0 16px;
    }
    .content {
        padding: 20px 16px 16px;
    }
    .d-footer {
        padding: 16px;
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    .hero {
        flex-direction: column;
        align-items: flex-start !important;
    }
    .grid > .col-6 {
        grid-column: span 12;
    }
    .grid > .col-8 {
        grid-column: span 12;
    }
    .grid > .col-4 {
        grid-column: span 12;
    }
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .cmd {
        display: none;
    }
    .auth-shell {
        grid-template-columns: 1fr;
    }
    .auth-aside {
        display: none;
    }
}

/* === Responsive: Small Mobile (≤480px) === */
@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    .hero-title {
        font-size: 22px !important;
    }
    .grid {
        gap: 14px;
    }
}

/* === Modal System === */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 200ms ease, visibility 200ms ease;
}
.modal-backdrop.is-open {
    opacity: 1;
    visibility: visible;
}
.modal-window {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: translateY(20px) scale(0.95);
    transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal-backdrop.is-open .modal-window {
    transform: translateY(0) scale(1);
}
.modal-head {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--t-base);
    margin: 0;
}
.modal-close {
    background: transparent;
    border: none;
    color: var(--t-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 150ms, color 150ms;
}
.modal-close:hover {
    background: var(--bg-muted);
    color: var(--danger);
}
.modal-body {
    padding: 24px;
}

/* Garante que o dropdown de perfil abra quando a classe is-open for adicionada */
.dd-menu.is-open { opacity: 1 !important; visibility: visible !important; transform: translateY(0) !important; pointer-events: auto !important; }
.dd-menu { opacity: 0; visibility: hidden; transform: translateY(-10px); transition: all 0.2s ease; pointer-events: none; }

.dd-wrap { position: relative; }
.dd-menu { position: absolute; top: calc(100% + 8px); right: 0; min-width: 220px; background: var(--bg-card); border: 1px solid var(--border-soft); box-shadow: var(--shadow-lg); border-radius: 12px; padding: 6px; z-index: 1000; }
/ *   = = =   D r o p d o w n   M e n u   = = =   * /  
 . d r o p d o w n - c o n t a i n e r   {  
         p o s i t i o n :   r e l a t i v e ;  
 }  
 . d r o p d o w n - m e n u   {  
         d i s p l a y :   n o n e ;  
         p o s i t i o n :   a b s o l u t e ;  
         r i g h t :   0 ;  
         t o p :   1 0 0 % ;  
         m a r g i n - t o p :   4 p x ;  
         b a c k g r o u n d :   v a r ( - - b g - c a r d ) ;  
         b o r d e r :   1 p x   s o l i d   v a r ( - - b o r d e r ) ;  
         b o r d e r - r a d i u s :   8 p x ;  
         b o x - s h a d o w :   0   1 0 p x   2 5 p x   - 5 p x   r g b a ( 0 ,   0 ,   0 ,   0 . 1 ) ,   0   8 p x   1 0 p x   - 6 p x   r g b a ( 0 ,   0 ,   0 ,   0 . 1 ) ;  
         p a d d i n g :   6 p x ;  
         z - i n d e x :   5 0 ;  
         m i n - w i d t h :   1 4 0 p x ;  
 }  
 . d r o p d o w n - m e n u . s h o w   {  
         d i s p l a y :   b l o c k ;  
         a n i m a t i o n :   d r o p - i n   0 . 2 s   c u b i c - b e z i e r ( 0 . 1 6 ,   1 ,   0 . 3 ,   1 )   f o r w a r d s ;  
 }  
 . d r o p d o w n - i t e m   {  
         d i s p l a y :   f l e x ;  
         a l i g n - i t e m s :   c e n t e r ;  
         g a p :   8 p x ;  
         w i d t h :   1 0 0 % ;  
         p a d d i n g :   8 p x   1 0 p x ;  
         b o r d e r - r a d i u s :   6 p x ;  
         f o n t - s i z e :   1 3 p x ;  
         f o n t - w e i g h t :   5 0 0 ;  
         c o l o r :   v a r ( - - t - b a s e ) ;  
         b a c k g r o u n d :   t r a n s p a r e n t ;  
         b o r d e r :   n o n e ;  
         c u r s o r :   p o i n t e r ;  
         t e x t - a l i g n :   l e f t ;  
         t r a n s i t i o n :   b a c k g r o u n d - c o l o r   0 . 1 5 s ,   c o l o r   0 . 1 5 s ;  
         t e x t - d e c o r a t i o n :   n o n e ;  
 }  
 . d r o p d o w n - i t e m : h o v e r   {  
         b a c k g r o u n d - c o l o r :   v a r ( - - b g - m u t e d ) ;  
 }  
 . d r o p d o w n - i t e m . d a n g e r   {  
         c o l o r :   v a r ( - - d a n g e r ) ;  
 }  
 . d r o p d o w n - i t e m . d a n g e r : h o v e r   {  
         b a c k g r o u n d - c o l o r :   v a r ( - - d a n g e r - s o f t ) ;  
 }  
 @ k e y f r a m e s   d r o p - i n   {  
         f r o m   {   o p a c i t y :   0 ;   t r a n s f o r m :   t r a n s l a t e Y ( - 5 p x ) ;   }  
         t o   {   o p a c i t y :   1 ;   t r a n s f o r m :   t r a n s l a t e Y ( 0 ) ;   }  
 }  
 
/* Sticky Footer Fix */
.main { display: flex; flex-direction: column; min-height: 100vh; }
.content { flex: 1 0 auto; }
.d-footer { flex-shrink: 0; }

/* Premium File Input Styling */
input[type="file"] {
    color: var(--t-muted);
    background-color: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    padding: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="file"]::-webkit-file-upload-button,
input[type="file"]::file-selector-button {
    background: linear-gradient(135deg, var(--primary), #6d28d9);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    margin-right: 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.25);
}

input[type="file"]:hover::-webkit-file-upload-button,
input[type="file"]:hover::file-selector-button {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.35);
}

input[type="file"]:active::-webkit-file-upload-button,
input[type="file"]:active::file-selector-button {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.25);
}

input[type="file"].input {
    padding: 4px;
    height: auto;
    min-height: 42px;
    display: flex;
    align-items: center;
}
