/* ==========================================================================
   ppzz.ee - Hand-drawn Sketchbook Dashboard
   Colors: #4A90D9, #E8863A, #FAFAF5, #D4D0C8, #2D2D2D, #F5C6D0, #FFF3B0
   Fonts: Patrick Hand, Nunito, Indie Flower
   ========================================================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(15px, 1.5vw, 18px);
    line-height: 1.7;
    color: #2D2D2D;
    background-color: #FAFAF5;
    background-image:
        linear-gradient(rgba(212, 208, 200, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(212, 208, 200, 0.06) 1px, transparent 1px);
    background-size: 24px 24px;
    overflow-x: hidden;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

h1, h2, h3, h4 {
    font-family: 'Patrick Hand', cursive;
    font-weight: 400;
}

/* --- Sketchbook Cover --- */
#notebook-cover {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1200px;
    background-color: #FAFAF5;
}

.cover-inner {
    width: 420px;
    height: 540px;
    position: relative;
    transform-style: preserve-3d;
}

.cover-front {
    width: 100%;
    height: 100%;
    background: #2D2D2D;
    border-radius: 4px 16px 16px 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transform-origin: left center;
    transition: transform 0.9s cubic-bezier(0.645, 0.045, 0.355, 1);
    box-shadow:
        4px 4px 20px rgba(0, 0, 0, 0.3),
        inset 0 0 60px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.cover-front.opened {
    transform: rotateY(-180deg);
    pointer-events: none;
}

.cover-texture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 2px,
            rgba(255, 255, 255, 0.02) 2px,
            rgba(255, 255, 255, 0.02) 4px
        );
}

.cover-title {
    font-family: 'Patrick Hand', cursive;
    font-size: 52px;
    color: #FAFAF5;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
    letter-spacing: 4px;
    z-index: 1;
}

.cover-doodle {
    position: absolute;
    opacity: 0.5;
    z-index: 1;
}

.cover-doodle-1 {
    top: 60px;
    right: 50px;
    transform: rotate(15deg);
}

.cover-doodle-2 {
    bottom: 80px;
    left: 40px;
    transform: rotate(-10deg);
}

.cover-doodle-3 {
    top: 120px;
    left: 60px;
    transform: rotate(5deg);
}

/* Cover fade out */
#notebook-cover.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

#notebook-cover.removed {
    display: none;
}

/* --- Dashboard Layout --- */
#dashboard {
    display: flex;
    min-height: 100vh;
    opacity: 1;
    transition: opacity 0.6s ease;
    padding-left: 40px;
}

#dashboard.hidden {
    opacity: 0;
}

/* --- Spiral Binding --- */
.spiral-binding {
    position: fixed;
    left: 0;
    top: 0;
    width: 40px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    z-index: 50;
    background: #FAFAF5;
    background-image:
        linear-gradient(rgba(212, 208, 200, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(212, 208, 200, 0.06) 1px, transparent 1px);
    background-size: 24px 24px;
}

.spiral-ring {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2.5px solid #9E9E9E;
    background: transparent;
    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.15);
    position: relative;
}

.spiral-ring::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -6px;
    width: 34px;
    height: 2px;
    background: #BCBCBC;
    transform: translateY(-50%);
    z-index: -1;
    border-radius: 1px;
}

/* --- Sidebar --- */
#sidebar {
    width: 200px;
    min-height: 100vh;
    padding: 30px 16px;
    border-right: 2px solid #D4D0C8;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-shrink: 0;
    position: relative;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    transition: background-color 0.25s ease, transform 0.15s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    color: #2D2D2D;
}

.nav-item:hover {
    background-color: #F5C6D0;
    transform: rotate(-0.5deg);
}

.nav-item.active {
    background-color: #F5C6D0;
}

.nav-icon {
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.nav-item:hover .nav-icon {
    transform: scale(1.15) rotate(3deg);
}

.nav-label {
    font-family: 'Patrick Hand', cursive;
    font-size: 18px;
    color: #2D2D2D;
}

.sidebar-doodle {
    padding: 20px 0;
    opacity: 0.6;
}

/* --- Main Content --- */
#main-content {
    flex: 1;
    padding: 24px;
    min-width: 0;
}

/* --- Widget Grid --- */
.widget-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 1200px;
}

/* --- Widget Base --- */
.widget {
    border: 2px solid #2D2D2D;
    border-radius: 12px;
    filter: url(#sketch);
    padding: 20px;
    background: #FAFAF5;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.widget:hover {
    transform: translateY(-2px) rotate(-0.3deg);
    box-shadow: 3px 3px 0 rgba(45, 45, 45, 0.1);
}

.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.widget-header h2 {
    font-size: clamp(20px, 2.5vw, 28px);
    color: #2D2D2D;
    transform: rotate(-0.3deg);
}

.widget-body {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(14px, 1.3vw, 16px);
    line-height: 1.7;
    color: #2D2D2D;
}

/* --- Overview Widget (2-col span) --- */
.widget-overview {
    grid-column: span 2;
}

.widget-illustration {
    margin-top: 16px;
    display: flex;
    justify-content: center;
}

/* --- Stats Widget --- */
.widget-stats .pie-charts {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
}

.pie-chart-doodle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.pie-chart-doodle svg {
    filter: url(#sketch);
}

.pie-label {
    font-family: 'Indie Flower', cursive;
    font-size: 13px;
    color: #2D2D2D;
}

/* --- Feature Cards --- */
.widget-feature {
    display: flex;
    flex-direction: column;
}

.widget-header-blue {
    background: #4A90D9;
    margin: -20px -20px 16px -20px;
    padding: 14px 20px;
    border-radius: 10px 10px 0 0;
}

.widget-header-blue h2 {
    color: #FAFAF5;
    transform: rotate(0.3deg);
}

.widget-header-orange {
    background: #E8863A;
    margin: -20px -20px 16px -20px;
    padding: 14px 20px;
    border-radius: 10px 10px 0 0;
}

.widget-header-orange h2 {
    color: #FAFAF5;
    transform: rotate(-0.4deg);
}

.widget-header-yellow {
    background: #FFF3B0;
    margin: -20px -20px 16px -20px;
    padding: 14px 20px;
    border-radius: 10px 10px 0 0;
}

.widget-header-yellow h2 {
    color: #2D2D2D;
    transform: rotate(0.2deg);
}

.feature-icon {
    margin-top: auto;
    padding-top: 12px;
    display: flex;
    justify-content: flex-end;
}

/* --- Book Widget --- */
.widget-book {
    grid-column: span 2;
}

.book-illustration {
    display: flex;
    justify-content: center;
    margin: 10px 0;
}

.annotation {
    font-family: 'Indie Flower', cursive;
    font-size: 15px;
    color: #2D2D2D;
    padding: 10px 14px;
    background: #FFF3B0;
    border-radius: 6px;
    transform: rotate(-0.5deg);
    margin-top: 8px;
}

/* --- Annotations Widget --- */
.widget-annotations {
    grid-column: span 1;
}

.notes-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.note-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px dashed #D4D0C8;
}

.note-item:last-child {
    border-bottom: none;
}

.note-bullet {
    width: 8px;
    height: 8px;
    min-width: 8px;
    border-radius: 50%;
    background: #E8863A;
    margin-top: 8px;
}

.note-text {
    font-family: 'Indie Flower', cursive;
    font-size: 14px;
    line-height: 1.5;
    color: #2D2D2D;
}

/* --- Ripple Effect --- */
.ripple-target {
    position: relative;
    overflow: hidden;
}

.ripple-span {
    position: absolute;
    border-radius: 50%;
    background: rgba(74, 144, 217, 0.2);
    transform: scale(0);
    animation: ripple-anim 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes ripple-anim {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* --- Footer --- */
#footer {
    border-top: 2px solid #D4D0C8;
    padding: 40px 24px;
    margin-left: 40px;
    background-color: #FAFAF5;
    background-image:
        linear-gradient(rgba(212, 208, 200, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(212, 208, 200, 0.12) 1px, transparent 1px);
    background-size: 24px 24px;
    text-align: center;
    transition: opacity 0.6s ease;
}

#footer.hidden {
    opacity: 0;
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
}

.footer-doodle {
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
}

.footer-text {
    font-family: 'Patrick Hand', cursive;
    font-size: 20px;
    color: #2D2D2D;
    margin-bottom: 10px;
    transform: rotate(-0.5deg);
}

.footer-links {
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    color: #4A90D9;
    margin-bottom: 8px;
}

.footer-links a {
    color: #4A90D9;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: #E8863A;
}

.footer-dot {
    margin: 0 8px;
    color: #D4D0C8;
}

.footer-note {
    font-family: 'Indie Flower', cursive;
    font-size: 13px;
    color: #D4D0C8;
    margin-top: 6px;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .widget-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .widget-overview {
        grid-column: span 2;
    }

    .widget-book {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    #sidebar {
        width: 60px;
        padding: 20px 8px;
    }

    .nav-label {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 10px;
    }

    .sidebar-doodle {
        display: none;
    }

    .widget-grid {
        grid-template-columns: 1fr;
    }

    .widget-overview,
    .widget-book {
        grid-column: span 1;
    }

    .spiral-binding {
        width: 24px;
    }

    .spiral-ring {
        width: 16px;
        height: 16px;
    }

    .spiral-ring::after {
        width: 26px;
        left: -4px;
    }

    #dashboard {
        padding-left: 24px;
    }

    #footer {
        margin-left: 24px;
    }
}

@media (max-width: 480px) {
    .cover-inner {
        width: 280px;
        height: 380px;
    }

    .cover-title {
        font-size: 36px;
    }

    .pie-charts {
        flex-direction: column;
    }
}
