/**
 * Common Styles
 * Shared styles for header, subheader, footer, and page container
 * Version: 1.2
 */

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

html,
body {
    overflow-x: hidden;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #f0f2f5 0%, #e3e6ea 50%, #d5d9e0 100%);
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.alert {
    padding: 16px 18px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 1.2em;
    line-height: 1.45;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.alert-with-icon {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.alert-with-icon i {
    margin-top: 3px;
    flex-shrink: 0;
    font-size: 18px;
    opacity: 0.9;
}

.alert-text {
    flex: 1;
}

/* ERROR */
.alert-error {
    background: #FDECEA;
    color: #8E0000;
    border-left: 5px solid #C62828;
}

/* SUCCESS */
.alert-success {
    background: #EAF7EE;
    color: #1B5E20;
    border-left: 5px solid #2E7D32;
}

/* WARNING */
.alert-warning {
    background: #FFF4E5;
    color: #7A4F01;
    border-left: 5px solid #FFB300;
}

.alert ul {
    margin: 8px 0 0 18px;
}

.alert-error i { color: #C62828; }
.alert-success i { color: #2E7D32; }
.alert-warning i { color: #FFB300; }

/* Header Styles */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

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

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

.header-left-logo {
    height: auto;
    width: auto;
}

.header-center-logo {
    position: relative;
    top: 7px;
    height: auto;
    width: auto;
}

.header-title {
    font-size: 3.5em;
    font-weight: 600;
    margin: 0;
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

/* ============================================================================
   SUBHEADER COMPONENT - Shared across dashboard, tree_view, person_edit, etc.
   ============================================================================ */

/* Outer container - provides max-width and centering */
.subheader-outer-container {
    max-width: 1200px;
    margin: 15px auto;
    padding: 0 20px;
}

/* Inner container - the white card/box */
.subheader-inner-container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

/* Text section (left side) */
.subheader-text {
    max-width: 75%;
}

.subheader-text h2 {
    color: #333;
    margin-bottom: 10px;
}

.subheader-text p {
    color: #666;
}

.stats-display {
    font-size: 1.2em;
    color: #666;
    margin-top: 5px;
    margin-bottom: 10px;
}

.btn {
    padding: 6px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    transition: background 0.3s;
    white-space: nowrap;
}

.btn:hover {
    background: #5568d3;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}


.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-secondary {
    background: #8571da;
    padding: 6px 12px;
    font-size: 14px;
}

.btn-secondary:hover {
    background: #6a55c9;
}

/* Buttons section (right side) */
.subheader-buttons {
    display: flex;
    /*flex-direction: column;*/
    align-items: flex-end;
    justify-content: space-between;
    height: 106px;
    /* must stretch to parent */
    white-space: nowrap;
    gap: 15px;
}

.subheader-buttons .btn i {
    margin-right: 6px;
}

/* START SQUARE */

.btn-square {
    display: inline-flex;
    flex-direction: column;
    /* icon on top, text below */
    align-items: center;
    justify-content: center;

    min-width: 95px;
    min-height: 95px;
    padding: 8px;

    background: #ea9966;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
    text-decoration: none;

    transition: background 0.3s, transform 0.15s;
}

.btn-square i {
    font-size: 20px;
    margin-bottom: 4px;
    /* space between icon and text */
}

/* Hover / focus */
.btn-square:hover,
.btn-square:focus-visible {
    background: #d88755;
}

/* Active / tap feedback */
.btn-square:active {
    transform: scale(0.95);
}

/* Mobile-friendly adjustments */
@media (max-width: 768px) {
    .btn-square {
        min-width: 60px;
        min-height: 60px;
        font-size: 16px;
        padding: 6px;
    }

    .btn-square i {
        font-size: 18px;
        margin-bottom: 2px;
    }
}

/* END SQUARE */

.user-info {
    font-size: 13px;
    opacity: 0.95;
}

.header-nav {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Page Container */
.page-container {
    flex: 1;
    width: 100%;
    background-image: url('/images/treebg6.png');
    background-size: cover;
}

/* Footer Styles */
.footer {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 10px;
    margin-top: auto;
    position: sticky;
    bottom: 0;
    z-index: 1000;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 13px;
}

.footer-left {
    color: #bdc3c7;
}

.footer-right {
    display: flex;
    gap: 20px;
}

.footer-right a {
    color: #ecf0f1;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-right a:hover {
    color: #3498db;
}

/* Responsive */
@media (max-width: 768px) {

    /* Disable sticky behavior on mobile */
    .header,
    .footer {
        position: static;
    }

    body {
        min-height: auto;
    }

    /* Footer fixes for mobile */
    .footer {
        position: static;
        /* disable sticky */
        margin-top: 0;
        /* remove auto spacing that confuses mobile */
    }

    .page-container {
        flex: 1 0 auto;
        /* allow content to fill space but not force footer sticky */
    }

    /* Stack header content cleanly */
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .header-title {
        font-size: 1.8em;
        line-height: 1.2;
    }

    .header-left-logo {
        height: auto;
    }

    .header-center-logo {
        height: 40px;
    }

    .header-right {
        width: 100%;
        align-items: flex-start;
        gap: 6px;
    }

    .header-nav {
        width: 100%;
        justify-content: flex-start;
        gap: 8px;
    }

    .header-nav a,
    .header-nav button {
        font-size: 12px;
        padding: 6px 10px;
    }

    .user-info {
        display: none;
    }

    .subheader-outer-container {
        margin: 10px auto;
        padding: 0 15px;
    }

    .subheader-inner-container {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
        margin-bottom: 20px;
    }

    .subheader-text {
        max-width: 100%;
    }

    .subheader-buttons {
        width: 100%;
        align-items: stretch;
    }

    .subheader-buttons .btn {
        width: 100%;
    }

    /* Footer cleanup */
    .footer-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 8px;
        font-size: 12px;
    }
}

/* Individual button container */
.individual-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    min-height: 120px;
}

/* Horizontal button container */
.horizontal-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    padding: 20px;
}

/* Vertical button container */
.vertical-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    padding: 20px;
    max-width: 400px;
    margin: 0 auto;
}

/* Button label */
.button-label {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
    text-align: center;
}

/* Flexible standalone metallic buttons */
.button-one,
.button-two,
.button-three,
.button-four,
.button-five,
.button-six, 
.button-disabled,
.button-view-tree {
    padding: 10px 25px;
    border: none;
    background: transparent;
    color: white;
    font-size: 1.1rem;
    font-weight: 400;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    z-index: 2;
    overflow: hidden;
    border-radius: 9px;
    min-height: 40px;
    min-width: 140px;
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

/* Even smaller variant for tighter spaces */
.button-one.small,
.button-two.small,
.button-three.small,
.button-four.small,
.button-five.small,
.button-six.small,
.button-disabled.small,
.button-view-tree.small {
    padding: 10px 20px;
    font-size: 0.85rem;
    min-height: 40px;
    min-width: 120px;
    border-radius: 10px;
}

/* Metallic shine overlay for standalone buttons */
.button-one::before,
.button-two::before,
.button-three::before,
.button-four::before,
.button-five::before,
.button-six::before,
.button-disabled::before,
.button-view-tree::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom,
            rgba(255, 255, 255, 0.3) 0%,
            rgba(255, 255, 255, 0.15) 30%,
            rgba(255, 255, 255, 0.08) 60%,
            rgba(255, 255, 255, 0) 100%);
    z-index: 1;
    pointer-events: none;
    border-radius: 12px;
}

.button-one.small::before,
.button-two.small::before,
.button-three.small::before,
.button-four.small::before,
.button-five.small::before,
.button-six.small::before,
.button-disabled.small::before,
.button-view-tree.small::before {
    border-radius: 10px;
}

/* Brushed metal texture for standalone buttons */
.button-one::after,
.button-two::after,
.button-three::after,
.button-four::after,
.button-five::after,
.button-six::after,
.button-disabled::after,
.button-view-tree::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(45deg,
            rgba(255, 255, 255, 0.15) 25%,
            transparent 25%,
            transparent 50%,
            rgba(255, 255, 255, 0.15) 50%,
            rgba(255, 255, 255, 0.15) 75%,
            transparent 75%,
            transparent);
    background-size: 6px 6px;
    z-index: 1;
    opacity: 0.4;
    pointer-events: none;
    mix-blend-mode: overlay;
    border-radius: 12px;
}

.button-one.small::after,
.button-two.small::after,
.button-three.small::after,
.button-four.small::after,
.button-five.small::after,
.button-six.small::after,
.button-disabled.small::after,
.button-view-tree.small::after {
    border-radius: 10px;
    background-size: 5px 5px;
}

/* Following for SAFARI Broiwser compatibility */
.button-two>*,
.button-three>*,
.button-four>*,
.button-five>*,
.button-six>*,
.button-disabled>*,
.button-view-tree>* {
    position: relative;
    z-index: 3;
}

/* Header palette standalone buttons */
.button-one {
    background: linear-gradient(145deg,
            #667eea 0%,
            #5a6fd8 50%,
            #4d60c6 100%);
}

.button-two {
    background: linear-gradient(145deg,
            #764ba2 0%,
            #6a4192 50%,
            #5e3782 100%);
}

.button-three {
    background: linear-gradient(145deg,
            #8a64cc 0%,
            #7c58b8 50%,
            #6e4ca4 100%);
}

/* Complementary palette standalone buttons */
.button-four {
    background: linear-gradient(145deg,
            #36d1dc 0%,
            #30c1cc 50%,
            #2ab1bc 100%);
}

.button-five {
    background: linear-gradient(145deg,
            #ff9a9e 0%,
            #f58c90 50%,
            #eb7e82 100%);
}

.button-six {
    background: linear-gradient(145deg,
            #78cc4d 0%,
            #66b33e 50%,
            #55992f 100%);
}

.button-disabled {
    background: linear-gradient(145deg,
            #d8d4dd 0%,
            #d8d5e6 50%,
            #acb0aa 100%);
    cursor: auto !important;
    opacity: 85%;
}

.button-view-tree {
    background: linear-gradient(145deg,
            #667eea 0%,
            #5a6fd8 50%,
            #4d60c6 100%);
    /* Position absolutely to not affect flow */
    position: absolute;
    top: 20px;
    right: 20px;
}

/* Hover states for ALL buttons */
.console-button:hover,
.button-one:hover,
.button-two:hover,
.button-three:hover,
.button-four:hover,
.button-five:hover,
.button-six:hover,
.button-view-tree:hover {
    transform: translateY(-1px);
    filter: brightness(1.15) saturate(1.1);
    box-shadow:
        0 10px 25px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.console-button::before,
.button-one:hover::before,
.button-two:hover::before,
.button-three:hover::before,
.button-four:hover::before,
.button-five:hover::before,
.button-six:hover::before,
.button-view-tree:hover::before {
    background: linear-gradient(to bottom,
            rgba(255, 255, 255, 0.45) 0%,
            rgba(255, 255, 255, 0.25) 30%,
            rgba(255, 255, 255, 0.15) 60%,
            rgba(255, 255, 255, 0.08) 100%);
}

.console-button::after,
.button-one:hover::after,
.button-two:hover::after,
.button-three:hover::after,
.button-four:hover::after,
.button-five:hover::after,
.button-six:hover::after,
.button-view-tree:hover::after {
    opacity: 0.7;
    background-size: 4px 4px;
    animation: metallicShine 0.5s ease;
}

@keyframes metallicShine {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 6px 6px;
    }
}

/* Active states for ALL buttons */
.console-button:active,
.button-one:active,
.button-two:active,
.button-three:active,
.button-four:active,
.button-five:active,
.button-six:active,
.button-view-tree:active {
    transform: translateY(1px);
    filter: brightness(0.95);
    transition: all 0.1s ease;
    box-shadow:
        inset 0 3px 10px rgba(0, 0, 0, 0.3),
        inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.console-button:active::before,
.button-one:active::before,
.button-two:active::before,
.button-three:active::before,
.button-four:active::before,
.button-five:active::before,
.button-six:active::before,
.button-view-tree:active::before {
    background: linear-gradient(to bottom,
            rgba(255, 255, 255, 0.2) 0%,
            rgba(255, 255, 255, 0.1) 30%,
            rgba(0, 0, 0, 0.1) 60%,
            rgba(0, 0, 0, 0.2) 100%);
}

.console-button:active::after,
.button-one:active::after,
.button-two:active::after,
.button-three:active::after,
.button-four:active::after,
.button-five:active::after,
.button-six:active::after,
.button-view-tree:active::after {
    opacity: 0.4;
    transform: translateY(1px);
}

/* Button icons */
.button-one i,
.button-two i,
.button-three i,
.button-four i,
.button-five i,
.button-six i,
.button-view-tree i {
    font-size: 1rem;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    position: relative;
    z-index: 2;
    transition: transform 0.3s ease;
}

.console-button.small,
.button-one.small i,
.button-two.small i,
.button-three.small i,
.button-four.small i,
.button-five.small i,
.button-six.small i,
.button-view-tree.small i {
    font-size: 0.9rem;
}

.button-one:hover i,
.button-two:hover i,
.button-three:hover i,
.button-four:hover i,
.button-five:hover i,
.button-six:hover i,
.button-view-tree:hover i {
    transform: scale(1.15);
}

.button-one:active i,
.button-two:active i,
.button-three:active i,
.button-four:active i,
.button-five:active i,
.button-six:active i,
.button-view-tree:active i {
    transform: scale(0.95);
}

.button-stretch {
    flex: 1;
}

.button-one .button-stretch {
    flex: 1;
}

@media (max-width: 1024px) {
    .standalone-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .standalone-buttons {
            grid-template-columns: 1fr;
    }

    .horizontal-container {
        flex-direction: column;
        gap: 15px;
    }

    h1 {
        font-size: 2.2rem;
    }

    .button-one span:not(.fa),
    .button-two span:not(.fa),
    .button-three span:not(.fa),
    .button-four span:not(.fa),
    .button-five span:not(.fa),
    .button-six span:not(.fa),
    .button-view-tree span:not(.fa) {
        display: none;
    }

    .button-one,
    .button-two,
    .button-three,
    .button-four,
    .button-five,
    .button-six,
    .button-view-tree {
        min-width: 60px;
        padding: 14px;
    }
}