* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

/* ==================== HEADER ==================== */
.header {
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    color: white;
    padding: 3rem 1rem;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.header h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.header p {
    font-size: 1.3rem;
    opacity: 0.9;
}

/* ==================== MAIN CONTENT - FLEXBOX ==================== */
.main-content {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* ==================== TRANSFORMATION SECTION ==================== */
.transformation-section {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.transformation-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.transformation-section.full-width {
    grid-column: 1 / -1;
}

.section-header {
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    color: white;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h2 {
    font-size: 1.8rem;
    margin: 0;
}

.badge {
    background: rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;
}

.section-content {
    padding: 2rem;
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.section-content.practical {
    flex-direction: column;
}

/* ==================== OBJAŠNJENJA ==================== */
.explanation {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.explanation h3 {
    font-size: 1.3rem;
    color: #0f2027;
    margin-top: 0;
}

.explanation h4 {
    color: #2c5364;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.explanation code {
    background: #f5f5f5;
    padding: 0.8rem 1rem;
    border-radius: 5px;
    display: block;
    font-family: 'Courier New', monospace;
    overflow-x: auto;
    border-left: 4px solid #2c5364;
    font-size: 0.9rem;
}

.explanation ul {
    list-style: none;
    padding-left: 0;
}

.explanation li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.explanation li:before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #2c5364;
    font-weight: bold;
}

.note {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 1rem;
    border-radius: 5px;
    margin: 1rem 0;
}

.note strong {
    color: #856404;
}

/* ==================== PRIMJERI - FLEXBOX ==================== */
.examples {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.practical-examples {
    flex-direction: row;
    flex-wrap: wrap;
}

.example {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 1rem;
    border: 2px solid #f0f0f0;
    transition: border-color 0.3s ease;
    flex: 1;
    min-width: 250px;
}

.example:hover {
    border-color: #2c5364;
}

.example h4 {
    margin-top: 0;
    color: #2c5364;
    margin-bottom: 1rem;
}

/* ==================== DEMO BOX ==================== */
.demo-box {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    height: 220px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
}

.demo-box::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(90deg, transparent, transparent 19px, rgba(44, 83, 100, 0.1) 19px, rgba(44, 83, 100, 0.1) 20px),
        repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(44, 83, 100, 0.1) 19px, rgba(44, 83, 100, 0.1) 20px);
    pointer-events: none;
}

/* ==================== PERSPECTIVE ==================== */
.perspective {
    perspective: 1000px;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.perspective-deep {
    perspective: 800px;
}

.perspective-container-400 {
    perspective: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.perspective-container-1000 {
    perspective: 1000px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.perspective-container-2000 {
    perspective: 2000px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* ==================== SHAPE - OSNOVNI OBLIK ==================== */
.shape {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(44, 83, 100, 0.3);
    position: relative;
    z-index: 1;
}

.label {
    font-size: 0.8rem;
    text-align: center;
}

/* ==================== 3D TRANSFORMACIJE ==================== */

/* ROTATE X */
.rotate-x-45 {
    transform: rotateX(45deg);
}

.rotate-x-75 {
    transform: rotateX(75deg);
}

.rotate-x-neg55 {
    transform: rotateX(-55deg);
}

.rotate-x-40 {
    transform: rotateX(40deg);
}

/* ROTATE Y */
.rotate-y-45 {
    transform: rotateY(45deg);
}

.rotate-y-60 {
    transform: rotateY(60deg);
}

.rotate-y-neg70 {
    transform: rotateY(-70deg);
}

/* ROTATE Z */
.rotate-z-45 {
    transform: rotateZ(45deg);
}

.rotate-z-90 {
    transform: rotateZ(90deg);
}

.rotate-z-neg60 {
    transform: rotateZ(-60deg);
}

/* TRANSLATE Z */
.translate-z-100 {
    transform: translateZ(100px);
}

.translate-z-200 {
    transform: translateZ(200px);
}

.translate-z-neg150 {
    transform: translateZ(-150px);
}

/* SCALE Z */
.scale-z-15 {
    transform: scaleZ(1.5) rotateX(45deg);
}

.scale-z-2 {
    transform: scaleZ(2) rotateX(45deg);
}

.scale-z-05 {
    transform: scaleZ(0.5) rotateX(45deg);
}

/* TRANSFORM ORIGIN 3D */
.origin-center-3d {
    transform-origin: center center;
    transform: rotateY(45deg);
}

.origin-left-3d {
    transform-origin: left center;
    transform: rotateY(45deg);
}

.origin-right-3d {
    transform-origin: right center;
    transform: rotateY(45deg);
}

/* KOMBINOVANE TRANSFORMACIJE */
.combined-xy {
    transform: rotateX(30deg) rotateY(45deg);
}

.combined-xyz {
    transform: rotateX(40deg) rotateY(40deg) rotateZ(20deg);
}

.combined-complex {
    transform: rotateX(35deg) rotateY(50deg) translateZ(50px) scale(1.1);
}

/* ==================== FLIP KARTICA ==================== */
.flip-card {
    background-color: transparent;
    width: 100%;
    height: 200px;
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 8px;
}

.flip-card-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.flip-card-back {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    transform: rotateY(180deg);
}

/* ==================== 3D KUB ==================== */
.cube {
    width: 100px;
    height: 100px;
    position: relative;
    transform-style: preserve-3d;
    animation: rotateCube 8s infinite linear;
}

.cube-face {
    position: absolute;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    opacity: 0.85;
    border: 2px solid rgba(255, 255, 255, 0.3);
    font-size: 0.9rem;
}

.cube-face.front {
    background: rgba(15, 32, 39, 0.8);
    transform: rotateY(0deg) translateZ(50px);
}

.cube-face.back {
    background: rgba(32, 58, 67, 0.8);
    transform: rotateY(180deg) translateZ(50px);
}

.cube-face.right {
    background: rgba(44, 83, 100, 0.8);
    transform: rotateY(90deg) translateZ(50px);
}

.cube-face.left {
    background: rgba(14, 42, 63, 0.8);
    transform: rotateY(-90deg) translateZ(50px);
}

.cube-face.top {
    background: rgba(30, 60, 114, 0.8);
    transform: rotateX(90deg) translateZ(50px);
}

.cube-face.bottom {
    background: rgba(10, 25, 47, 0.8);
    transform: rotateX(-90deg) translateZ(50px);
}

@keyframes rotateCube {
    0% {
        transform: rotateX(0deg) rotateY(0deg);
    }
    100% {
        transform: rotateX(360deg) rotateY(360deg);
    }
}

/* ==================== TILT KARTICA ==================== */
.tilt-card {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    transform: perspective(600px) rotateX(10deg) rotateY(-15deg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* ==================== CODE BLOK ==================== */
.example code {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 0.8rem;
    border-radius: 5px;
    display: block;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    line-height: 1.4;
}

/* ==================== FOOTER ==================== */
.footer {
    background: #0f0f0f;
    color: white;
    padding: 3rem 1rem;
    margin-top: 3rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
}

.footer-content h3 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.footer-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
    justify-content: space-around;
}

.footer-section {
    flex: 1;
    min-width: 150px;
}

.footer-section h4 {
    color: #2c5364;
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    padding: 0.5rem 0;
    padding-left: 1rem;
    position: relative;
}

.footer-section li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: #2c5364;
}

.footer-section a {
    color: #ccc;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: #2c5364;
}

.footer-content p {
    text-align: center;
    border-top: 1px solid #444;
    padding-top: 1.5rem;
    opacity: 0.8;
}

/* ==================== RESPONSIVE DESIGN ==================== */

@media (max-width: 1200px) {
    .section-content {
        flex-direction: column;
    }

    .examples {
        flex-direction: row;
    }

    .example {
        flex: 1 1 calc(50% - 1rem);
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .header p {
        font-size: 1rem;
    }

    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .section-header h2 {
        font-size: 1.3rem;
    }

    .section-content {
        padding: 1.5rem;
        flex-direction: column;
    }

    .examples {
        flex-direction: column;
    }

    .example {
        flex: 1 1 100%;
    }

    .demo-box {
        height: 150px;
    }

    .shape {
        width: 60px;
        height: 60px;
    }

    .explanation code {
        font-size: 0.75rem;
    }

    .example code {
        font-size: 0.75rem;
    }

    .footer-grid {
        flex-direction: column;
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 1.5rem 1rem;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .header p {
        font-size: 0.9rem;
    }

    .main-content {
        padding: 0 0.5rem;
        gap: 1rem;
    }

    .section-header {
        padding: 1rem;
    }

    .section-header h2 {
        font-size: 1.1rem;
    }

    .section-content {
        padding: 1rem;
    }

    .demo-box {
        height: 120px;
    }

    .shape {
        width: 50px;
        height: 50px;
    }

    .label {
        font-size: 0.6rem;
    }

    .explanation code,
    .example code {
        font-size: 0.65rem;
        padding: 0.5rem;
    }

    .practical-examples {
        flex-direction: column;
    }

    .example {
        flex: 1 1 100%;
    }
}