/**
 * EzeTree Layout Styles
 * Global layout: header, footer, sidebar, main content area
 */

/* Page Layout */
.page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page-content {
    flex: 1;
    display: flex;
}

/* Main Header */
.main-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    border-bottom: 3px solid var(--secondary);
    padding: 0 var(--space-lg);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

.header-container {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.header-logo a {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.header-logo svg {
    width: 32px;
    height: 32px;
    fill: var(--secondary);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.header-nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius);
    transition: var(--transition);
}

.header-nav-link:hover,
.header-nav-link.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.header-nav-link svg {
    width: 20px;
    height: 20px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.header-user-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius);
    transition: var(--transition);
}

.header-user-info:hover {
    background: rgba(255, 255, 255, 0.1);
}

.header-user-name {
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.header-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--bg-dark);
}

.header-mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: var(--space-sm);
}

/* Main Footer */
.main-footer {
    background: var(--bg-medium);
    border-top: 1px solid var(--border);
    padding: var(--space-lg);
    text-align: center;
}

.footer-container {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.footer-copyright {
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.footer-links {
    display: flex;
    gap: var(--space-lg);
}

.footer-link {
    color: var(--text-muted);
    font-size: var(--text-sm);
    text-decoration: none;
    transition: var(--transition);
}

.footer-link:hover {
    color: var(--text-primary);
}

.footer-powered {
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.footer-powered a {
    color: var(--secondary);
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-medium);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
}

.sidebar-section {
    margin-bottom: var(--space-lg);
}

.sidebar-section-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-sm);
    padding: 0 var(--space-sm);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius);
    transition: var(--transition);
}

.sidebar-nav-link:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.sidebar-nav-link.active {
    background: var(--primary);
    color: var(--text-primary);
}

.sidebar-nav-link svg {
    width: 20px;
    height: 20px;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow: auto;
    background: var(--bg-dark);
}

.content-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-xl);
}

.content-header {
    margin-bottom: var(--space-xl);
}

.content-title {
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.content-subtitle {
    color: var(--text-secondary);
}

/* Auth Layout (for login/register pages) */
.auth-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.auth-logo svg {
    width: 48px;
    height: 48px;
    fill: var(--secondary);
}

.auth-logo-text {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
}

.auth-title {
    font-size: var(--text-xl);
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.auth-subtitle {
    color: var(--text-muted);
}

.auth-card {
    background: var(--bg-medium);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
}

.auth-footer {
    text-align: center;
    margin-top: var(--space-lg);
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.auth-footer a {
    color: var(--primary-light);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-lg);
}

.dashboard-stat {
    background: var(--bg-medium);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.dashboard-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
}

.dashboard-stat-icon svg {
    width: 24px;
    height: 24px;
    fill: var(--text-primary);
}

.dashboard-stat-value {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
}

.dashboard-stat-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* Tree Card */
.tree-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-lg);
}

.tree-card {
    background: var(--bg-medium);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.tree-card-delete {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    z-index: 10;
}

.tree-card:hover .tree-card-delete {
    opacity: 1;
}

.tree-card-delete:hover {
    background: var(--danger);
}

.tree-card-delete svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.tree-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.tree-card-header {
    padding: var(--space-lg);
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.tree-card-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tree-card-icon svg {
    width: 24px;
    height: 24px;
    fill: var(--text-primary);
}

.tree-card-name {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.tree-card-body {
    padding: var(--space-lg);
}

.tree-card-stats {
    display: flex;
    gap: var(--space-lg);
    margin-bottom: var(--space-md);
}

.tree-card-stat {
    text-align: center;
}

.tree-card-stat-value {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.tree-card-stat-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
}

.tree-card-date {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.tree-card-new {
    border: 2px dashed var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    gap: var(--space-md);
}

.tree-card-new:hover {
    border-color: var(--primary-light);
    background: var(--bg-light);
}

.tree-card-new svg {
    width: 48px;
    height: 48px;
    fill: var(--text-muted);
}

.tree-card-new span {
    color: var(--text-muted);
    font-weight: 500;
}

/* Responsive */
@media (max-width: 1200px) {
    .sidebar {
        width: 240px;
    }
}

@media (max-width: 900px) {
    .header-nav {
        display: none;
    }

    .header-mobile-toggle {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        top: 60px;
        bottom: 0;
        z-index: var(--z-modal);
        transition: var(--transition);
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: calc(var(--z-modal) - 1);
    }

    .sidebar.open + .sidebar-overlay {
        display: block;
    }

    .footer-container {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 600px) {
    .header-container {
        padding: 0 var(--space-md);
    }

    .header-user-name {
        display: none;
    }

    .content-container {
        padding: var(--space-md);
    }

    .auth-container {
        padding: 0 var(--space-md);
    }

    .auth-card {
        padding: var(--space-lg);
    }

    .dashboard-grid,
    .tree-grid {
        grid-template-columns: 1fr;
    }
}
