﻿/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(180deg, #f3f4f6, #ffffff);
    color: #111827;
    perspective: 800px;
    padding: 20px;
    min-height: 100vh;
}

/* Headings */
h1 {
    font-size: 2.3rem;
    font-weight: 700;
    color: #047857;
    margin-bottom: 20px;
    text-shadow: 0 2px 3px rgba(4, 120, 87, 0.2);
    position: relative;
    animation: bounceIn 0.8s ease;
    transform-style: preserve-3d;
}

    h1::after {
        content: '';
        width: 50px;
        height: 4px;
        background: linear-gradient(90deg, #047857, #10b981);
        position: absolute;
        bottom: -8px;
        left: 0;
        transition: width 0.3s ease, box-shadow 0.3s ease;
    }

    h1:hover::after {
        width: 80px;
        box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
    }

h3, h4 {
    color: #047857;
    font-weight: 600;
    margin-bottom: 15px;
    animation: fadeIn 0.8s ease;
}

/* Alerts */
.alert {
    border-radius: 8px;
    padding: 12px 20px;
    margin-bottom: 20px;
    animation: pulseBounce 1.5s ease;
    transform-style: preserve-3d;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.alert-success {
    background: #d1fae5;
    color: #047857;
    border: none;
}

.alert-danger {
    background: #fee2e2;
    color: #b91c1c;
    border: none;
}

/* Buttons */
.btn {
    border-radius: 20px;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
    transform-style: preserve-3d;
    text-decoration: none;
    background: linear-gradient(90deg, #047857, #10b981);
    border: none;
    color: #ffffff;
}

    .btn:hover {
        transform: translateZ(12px) rotateX(8deg) scale(1.1);
        box-shadow: 0 6px 15px rgba(16, 185, 129, 0.5);
        background: linear-gradient(90deg, #10b981, #047857);
        animation: shake 0.2s ease;
    }

.btn-primary {
    background: linear-gradient(90deg, #047857, #10b981);
}

.btn-secondary {
    background: linear-gradient(90deg, #64748b, #94a3b8);
    color: #ffffff;
}

    .btn-secondary:hover {
        box-shadow: 0 6px 15px rgba(100, 116, 139, 0.5);
    }

.btn-warning {
    background: linear-gradient(90deg, #d97706, #f59e0b);
    color: #111827;
}

    .btn-warning:hover {
        box-shadow: 0 6px 15px rgba(245, 158, 11, 0.5);
    }

.btn-danger {
    background: linear-gradient(90deg, #b91c1c, #dc2626);
}

    .btn-danger:hover {
        box-shadow: 0 6px 15px rgba(220, 38, 38, 0.5);
    }

.btn-info {
    background: linear-gradient(90deg, #047857, #10b981);
}

    .btn-info:hover {
        box-shadow: 0 6px 15px rgba(16, 185, 129, 0.5);
    }

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Manage View - Table */
.table {
    background: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
    animation: slideUp 0.8s ease;
    margin-bottom: 20px;
}

    .table thead {
        background: linear-gradient(90deg, #047857, #10b981);
        color: #ffffff;
    }

    .table th {
        padding: 15px;
        font-weight: 700;
        text-align: left;
    }

    .table tbody tr {
        background: #f9fafb;
        transition: all 0.3s ease;
        transform-style: preserve-3d;
        animation: flipInY 0.7s ease forwards;
        animation-delay: calc(0.1s * var(--i, 0));
    }

        .table tbody tr:hover {
            transform: translateZ(20px) scale(1.02) rotateX(5deg);
            background: #d1fae5;
            box-shadow: 0 10px 20px rgba(16, 185, 129, 0.4);
            outline: 2px solid #10b981;
        }

    .table td {
        padding: 12px;
        vertical-align: middle;
        border-color: #e5e7eb;
    }

    .table img {
        width: 80px;
        border-radius: 8px;
        transition: all 0.3s ease;
        transform-style: preserve-3d;
    }

        .table img:hover {
            transform: translateZ(15px) rotateY(10deg) scale(1.15);
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
        }

    .table .btn-group {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }

/* Forms (Create/Edit) */
form {
    background: #ffffff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
    animation: slideUp 0.8s ease;
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
}

.control-label {
    font-weight: 600;
    color: #047857;
    margin-bottom: 8px;
    display: block;
}

.form-control {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px;
    font-size: 0.95rem;
    background: #f9fafb;
    transition: all 0.3s ease;
    transform-style: preserve-3d;
}

    .form-control:focus {
        border-color: #10b981;
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
        transform: translateZ(5px);
        outline: none;
        animation: shake 0.2s ease;
    }

.text-danger {
    font-size: 0.85rem;
    color: #dc2626;
    margin-top: 5px;
    display: block;
}

input[type="file"] {
    padding: 8px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.form-group img {
    width: 100px;
    border-radius: 8px;
    margin-top: 10px;
    transition: all 0.3s ease;
    transform-style: preserve-3d;
}

    .form-group img:hover {
        transform: translateZ(15px) rotateY(10deg);
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    }

.form-group .btn-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Delete View */
.delete-view {
    max-width: 600px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
    animation: flipInX 0.8s ease;
    transform-style: preserve-3d;
}

    .delete-view:hover {
        transform: translateZ(20px) rotateX(4deg);
        box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3);
    }

    .delete-view hr {
        border-color: #e5e7eb;
        margin: 20px 0;
    }

    .delete-view .btn-group {
        display: flex;
        gap: 10px;
        margin-top: 20px;
    }

    .delete-view img {
        width: 120px;
        border-radius: 8px;
        transition: all 0.3s ease;
        transform-style: preserve-3d;
    }

        .delete-view img:hover {
            transform: translateZ(15px) rotateY(10deg);
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
        }

/* Details View */
.details-view {
    max-width: 600px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
    animation: flipInX 0.8s ease;
    transform-style: preserve-3d;
}

    .details-view:hover {
        transform: translateZ(20px) rotateX(4deg);
        box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3);
    }

    .details-view hr {
        border-color: #e5e7eb;
        margin: 20px 0;
    }

    .details-view .row {
        margin-bottom: 10px;
    }

    .details-view dt {
        font-weight: 600;
        color: #047857;
    }

    .details-view dd {
        color: #111827;
    }

    .details-view img {
        width: 200px;
        border-radius: 8px;
        transition: all 0.3s ease;
        transform-style: preserve-3d;
    }

        .details-view img:hover {
            transform: translateZ(15px) rotateY(10deg);
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
        }

    .details-view .btn-group {
        display: flex;
        gap: 10px;
        margin-top: 20px;
    }

/* Animations */
@keyframes bounceIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    60% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(1);
    }
}

@keyframes flipInX {
    from {
        transform: rotateX(90deg);
        opacity: 0;
    }

    to {
        transform: rotateX(0);
        opacity: 1;
    }
}

@keyframes flipInY {
    from {
        transform: rotateY(90deg);
        opacity: 0;
    }

    to {
        transform: rotateY(0);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes pulseBounce {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 5px rgba(16, 185, 129, 0.2);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(-2px);
    }
}

/* Responsive Design */
@media (max-width: 991px) {
    h1 {
        font-size: 2rem;
    }

    .table {
        overflow-x: auto;
    }

        .table th, .table td {
            padding: 10px;
            font-size: 0.9rem;
        }

    .form-group {
        margin-bottom: 15px;
    }

    .form-control {
        font-size: 0.9rem;
    }

    .btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    form, .delete-view, .details-view {
        padding: 15px;
    }

        .table img, .form-group img, .delete-view img {
            width: 80px;
        }
}

@media (max-width: 576px) {
    body {
        padding: 10px;
    }

    h1 {
        font-size: 1.8rem;
    }

    h3, h4 {
        font-size: 1.2rem;
    }

    .table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

        .table thead {
            display: none;
        }

        .table tbody tr {
            display: block;
            margin-bottom: 10px;
            border: 1px solid #e5e7eb;
            border-radius: 8px;
            padding: 8px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
        }

        .table td {
            display: block;
            text-align: left;
            padding: 8px 10px;
            border: none;
            font-size: 0.85rem;
        }

            .table td::before {
                content: attr(data-label);
                font-weight: 600;
                color: #047857;
                display: block;
                margin-bottom: 5px;
                font-size: 0.9rem;
            }

            .table td[data-label="Image"] img {
                width: 60px;
            }

        .table .btn-group {
            flex-direction: column;
            gap: 5px;
        }

    .btn {
        width: 100%;
        text-align: center;
        font-size: 0.85rem;
    }

    .form-group .btn-group {
        flex-direction: column;
        gap: 8px;
    }

    .form-control {
        font-size: 0.85rem;
        padding: 8px;
    }

    form, .delete-view, .details-view {
        padding: 12px;
        max-width: 100%;
    }

        .details-view .row {
            flex-direction: column;
        }

        .details-view dt, .details-view dd {
            width: 100%;
            margin-bottom: 5px;
            font-size: 0.85rem;
        }

        .delete-view img, .details-view img {
            width: 80px;
        }
        /* Touch-friendly hover replacement */
        .table tbody tr:active, .btn:active, img:active, .delete-view:active, .details-view:active {
            transform: scale(0.98);
            box-shadow: 0 2px 5px rgba(16, 185, 129, 0.3);
        }
}
