/* ===== ADMIN.CSS - Layout Principal do CMS ===== */

/* Reset e configurações básicas */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Layout principal usando CSS Grid */
#app {
    display: grid;
    grid-template-areas: 
        "header header"
        "sidebar content"
        "footer footer";
    grid-template-rows: 70px 1fr 50px;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
    transition: grid-template-columns 0.3s ease;
}

/* Quando sidebar está colapsada */
#app.sidebar-collapsed {
    grid-template-columns: 0 1fr;
}

/* ===== HEADER ===== */
#header {
    grid-area: header;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    position: relative;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.menu-toggle:hover {
    background-color: rgba(255,255,255,0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-img {
    height: 40px;
    width: auto;
    border-radius: 4px;
}

.logo h1 {
    font-size: 24px;
    font-weight: 600;
    color: white;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.user-info i {
    font-size: 20px;
}

.btn-logout {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    text-decoration: none;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

/* ===== SIDEBAR ===== */
#sidebar {
    grid-area: sidebar;
    background: #ffffff;
    border-right: 1px solid #e9ecef;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
    overflow-y: auto;
    overflow-x: hidden;
    transition: margin-left 0.3s ease;
    z-index: 999;
}

#sidebar.collapsed {
    margin-left: -280px;
}

.main-menu {
    padding: 20px 0;
}

.menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.menu-item {
    margin-bottom: 2px;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #495057;
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    position: relative;
    font-weight: 500;
}

.menu-link:hover {
    background-color: #f8f9fa;
    color: #2a5298;
    border-left-color: #2a5298;
    text-decoration: none;
}

.menu-link.active {
    background-color: #e3f2fd;
    color: #1e3c72;
    border-left-color: #1e3c72;
    font-weight: 600;
}

.menu-link i {
    width: 20px;
    margin-right: 12px;
    font-size: 16px;
    text-align: center;
}

.menu-link span {
    flex: 1;
}

.submenu-arrow {
    margin-left: auto;
    transition: transform 0.3s;
    font-size: 12px;
}

.has-submenu.open .submenu-arrow {
    transform: rotate(180deg);
}

/* Submenu */
.submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
}

.has-submenu.open .submenu {
    max-height: 500px;
}

.submenu li {
    margin: 0;
}

.submenu a {
    display: flex;
    align-items: center;
    padding: 10px 20px 10px 52px;
    color: #6c757d;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 14px;
    font-weight: 400;
}

.submenu a:hover {
    background-color: #e9ecef;
    color: #2a5298;
    text-decoration: none;
}

.submenu a.active {
    background-color: #dee2e6;
    color: #1e3c72;
    font-weight: 600;
}

.submenu a i {
    width: 16px;
    margin-right: 8px;
    font-size: 14px;
}

/* ===== MAIN CONTENT ===== */
#main-content {
    grid-area: content;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.breadcrumb {
    background-color: #ffffff;
    padding: 15px 25px;
    border-bottom: 1px solid #e9ecef;
    font-size: 14px;
    color: #6c757d;
    flex-shrink: 0;
}

.breadcrumb-item {
    font-weight: 500;
}

.breadcrumb-item::before {
    content: "/";
    margin: 0 8px;
    color: #6c757d;
}

.breadcrumb-item:first-child::before {
    display: none;
}

.content {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    background-color: #f8f9fa;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px;
    color: #6c757d;
    background: rgba(255, 255, 255, 0.9);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
}

.loading i {
    font-size: 32px;
    margin-bottom: 10px;
    color: #2a5298;
    animation: spin 1s linear infinite;
}

.loading span {
    font-size: 14px;
    font-weight: 500;
}

/* Error Message */
.error-message {
    text-align: center;
    padding: 50px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 20px;
}

.error-message i {
    font-size: 48px;
    color: #dc3545;
    margin-bottom: 20px;
}

.error-message h3 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 24px;
}

.error-message p {
    color: #6c757d;
    margin-bottom: 20px;
    line-height: 1.5;
}

.error-message small {
    color: #adb5bd;
    font-size: 12px;
}

/* ===== FOOTER ===== */
#footer {
    grid-area: footer;
    background-color: #ffffff;
    border-top: 1px solid #e9ecef;
    padding: 0 25px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    font-size: 12px;
    color: #6c757d;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-links a {
    color: #2a5298;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: #1e3c72;
    text-decoration: underline;
}

/* ===== ANIMAÇÕES ===== */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 1024px) {
    #app {
        grid-template-columns: 260px 1fr;
    }
    
    .content {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    #app {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "header"
            "content"
            "footer";
    }
    
    #sidebar {
        position: fixed;
        top: 70px;
        left: 0;
        height: calc(100vh - 120px);
        z-index: 999;
        margin-left: -280px;
        width: 280px;
    }
    
    #sidebar.show {
        margin-left: 0;
        box-shadow: 0 0 20px rgba(0,0,0,0.3);
    }
    
    .content {
        padding: 15px;
    }
    
    .header-content {
        padding: 0 15px;
    }
    
    .logo h1 {
        font-size: 20px;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: 0 10px;
    }
    
    .logo h1 {
        font-size: 18px;
    }
    
    .user-info span {
        display: none;
    }
    
    .btn-logout span {
        display: none;
    }
    
    .content {
        padding: 10px;
    }
    
    .breadcrumb {
        padding: 10px 15px;
        font-size: 12px;
    }
}

/* ===== ESTADOS DE FOCO E ACESSIBILIDADE ===== */
.menu-toggle:focus,
.menu-link:focus,
.btn-logout:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.submenu a:focus {
    outline: 2px solid #2a5298;
    outline-offset: 2px;
}

/* Melhorar contraste para leitores de tela */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== SCROLLBAR CUSTOMIZADA ===== */
#sidebar::-webkit-scrollbar {
    width: 4px;
}

#sidebar::-webkit-scrollbar-track {
    background: transparent;
}

#sidebar::-webkit-scrollbar-thumb {
    background: rgba(108, 117, 125, 0.3);
    border-radius: 2px;
}

#sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(108, 117, 125, 0.5);
}

.content::-webkit-scrollbar {
    width: 8px;
}

.content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}