.flash-messages {
    max-width: 1440px;
    margin: 1rem auto 0;
    padding: 0 1.5rem;
    z-index: 150;
    position: relative;
}
.flash-message {
    padding: 1rem 1.5rem;
    border-radius: 20px;
    margin-bottom: 0.5rem;
    backdrop-filter: blur(10px);
    font-weight: 500;
    animation: slideDown 0.3s ease;
}
@keyframes slideDown {
    0% { opacity: 0; transform: translateY(-20px); }
    100% { opacity: 1; transform: translateY(0); }
}
.flash-message.success {
    background: rgba(247, 151, 29, 0.15);
    border: 1px solid rgba(247, 151, 29, 0.2);
    color: #f7971d;
}
.flash-message.error {
    background: rgba(255, 50, 50, 0.15);
    border: 1px solid rgba(255, 50, 50, 0.2);
    color: #ff6b6b;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 3rem;
    margin-bottom: 2rem;
}

.project-card {
    background: rgba(10, 8, 8, 0.5);
    border-radius: 28px;
    border: 1px solid rgba(247, 151, 29, 0.05);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    position: relative;
    cursor: pointer;
}
.project-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: rgba(247, 151, 29, 0.15);
    background: rgba(20, 16, 14, 0.7);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.7);
}
.project-card .card-img {
    width: 100%;
    aspect-ratio: 16/10;
    background: #14100e;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.project-card .card-img img,
.project-card .card-img video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: 0.4s;
}
.project-card:hover .card-img img,
.project-card:hover .card-img video {
    transform: scale(1.04);
}
.project-card .card-img .media-count {
    position: absolute;
    bottom: 10px;
    right: 12px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.05);
}
.project-card .card-body {
    padding: 1.6rem 1.8rem 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.project-card .card-body h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: #e8ddd0;
    letter-spacing: -0.02em;
}
.project-card .card-body h3 .highlight {
    color: #f7971d;
}
.project-card .card-body p {
    font-weight: 300;
    color: rgba(200, 180, 160, 0.5);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 4.8em;
}
.project-card .card-body .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.project-card .card-body .tags span {
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    background: rgba(247, 151, 29, 0.04);
    padding: 0.2rem 0.9rem;
    border-radius: 30px;
    color: rgba(200, 180, 160, 0.3);
    border: 1px solid rgba(247, 151, 29, 0.03);
}
.project-card .action-buttons {
    position: absolute;
    top: 12px;
    right: 12px;
    display: none;
    gap: 6px;
    z-index: 5;
}
.project-card .action-buttons.show {
    display: flex;
}
.project-card .action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: 0.3s;
    backdrop-filter: blur(4px);
}
.project-card .action-btn.delete-btn {
    background: rgba(255, 50, 50, 0.15);
    color: #ff6b6b;
    border: 1px solid rgba(255, 50, 50, 0.2);
}
.project-card .action-btn.delete-btn:hover {
    background: rgba(255, 50, 50, 0.3);
    transform: scale(1.1);
}
.project-card .action-btn.edit-btn {
    background: rgba(247, 151, 29, 0.12);
    color: #f7971d;
    border: 1px solid rgba(247, 151, 29, 0.15);
}
.project-card .action-btn.edit-btn:hover {
    background: rgba(247, 151, 29, 0.25);
    transform: scale(1.1);
}

@media (max-width: 820px) {
    .project-card .action-buttons {
        display: flex;
    }
}

.viewer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(10, 8, 8, 0.92);
    backdrop-filter: blur(20px);
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.viewer-overlay.open {
    display: flex;
}
.viewer-modal {
    background: #14100e;
    border: 1px solid rgba(247, 151, 29, 0.08);
    border-radius: 40px;
    max-width: 1000px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.9);
    animation: modalFade 0.25s ease;
    position: relative;
}
.viewer-modal .viewer-close {
    position: absolute;
    top: 16px;
    right: 18px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    color: rgba(200, 180, 160, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.viewer-modal .viewer-close:hover {
    background: rgba(255,255,255,0.1);
    color: #e8ddd0;
}

.viewer-slides {
    flex: 1;
    position: relative;
    min-height: 400px;
    background: #0a0808;
    overflow: hidden;
}

.viewer-slides .slides-track {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 400px;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.viewer-slides .slide {
    flex: 0 0 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    min-height: 400px;
    max-height: 60vh;
}

.viewer-slides .slide img,
.viewer-slides .slide video {
    width: 100%;
    height: 100%;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 12px;
    user-select: none;
    -webkit-user-drag: none;
}

.viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    color: rgba(200, 180, 160, 0.5);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}
.viewer-nav:hover {
    background: rgba(255,255,255,0.1);
    color: #e8ddd0;
}
.viewer-nav.prev { left: 16px; }
.viewer-nav.next { right: 16px; }

.viewer-info {
    padding: 1.5rem 2rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}
.viewer-info .viewer-text h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #e8ddd0;
    margin-bottom: 0.2rem;
}
.viewer-info .viewer-text .viewer-desc {
    color: rgba(200, 180, 160, 0.4);
    font-weight: 300;
    font-size: 0.95rem;
}
.viewer-info .viewer-text .viewer-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.viewer-info .viewer-text .viewer-tags span {
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    background: rgba(247, 151, 29, 0.04);
    padding: 0.2rem 0.9rem;
    border-radius: 30px;
    color: rgba(200, 180, 160, 0.3);
    border: 1px solid rgba(247, 151, 29, 0.03);
}
.viewer-info .viewer-link {
    background: rgba(247, 151, 29, 0.08);
    border: 1px solid rgba(247, 151, 29, 0.12);
    color: #e8ddd0;
    padding: 0.7rem 1.8rem;
    border-radius: 40px;
    text-decoration: none;
    font-weight: 500;
    transition: 0.3s;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}
.viewer-info .viewer-link:hover {
    background: rgba(247, 151, 29, 0.16);
    border-color: rgba(247, 151, 29, 0.25);
    transform: scale(1.02);
}
.viewer-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    border: 1px solid rgba(255,255,255,0.04);
    z-index: 5;
    transition: opacity 0.3s;
}

.add-btn-wrapper {
    display: flex;
    justify-content: center;
    margin: 1rem 0 2.5rem;
}
.add-btn-wrapper.hidden {
    display: none;
}
.add-btn {
    background: rgba(247, 151, 29, 0.06);
    border: 1px dashed rgba(247, 151, 29, 0.2);
    color: rgba(200, 180, 160, 0.5);
    padding: 0.8rem 3rem;
    border-radius: 60px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: 0.3s;
    font-family: 'Space Grotesk', sans-serif;
    backdrop-filter: blur(4px);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}
.add-btn:hover {
    background: rgba(247, 151, 29, 0.12);
    border-color: rgba(247, 151, 29, 0.4);
    color: #e8ddd0;
    transform: scale(1.02);
}
.add-btn:active {
    transform: scale(0.96);
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(10, 8, 8, 0.7);
    backdrop-filter: blur(12px);
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.modal-overlay.open {
    display: flex;
}
.modal {
    background: #14100e;
    border: 1px solid rgba(247, 151, 29, 0.1);
    border-radius: 48px;
    max-width: 560px;
    width: 100%;
    padding: 2.5rem 2rem 2rem;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.8);
    animation: modalFade 0.25s ease;
    max-height: 95vh;
    overflow-y: auto;
}
@keyframes modalFade {
    0% { opacity: 0; transform: scale(0.94) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
.modal h2 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: #e8ddd0;
}
.modal .sub {
    color: rgba(200, 180, 160, 0.3);
    font-weight: 300;
    margin-bottom: 1.8rem;
}

.input-group {
    position: relative;
    margin-top: 1.5rem;
}
.input-group:first-of-type {
    margin-top: 0;
}

.input {
    border: solid 1.5px #9e9e9e;
    border-radius: 1rem;
    background: none;
    padding: 1rem;
    font-size: 1rem;
    color: #f5f5f5;
    transition: border 150ms cubic-bezier(0.4,0,0.2,1);
    width: 100%;
    font-family: 'Space Grotesk', sans-serif;
}
.input:focus, .input:not(:placeholder-shown) {
    outline: none;
    border: 1.5px solid #f7971d;
}
.input:focus ~ .user-label, .input:not(:placeholder-shown) ~ .user-label {
    transform: translateY(-50%) scale(0.8);
    background-color: #14100e;
    padding: 0 0.4em;
    color: #f7971d;
}
.user-label {
    position: absolute;
    left: 15px;
    color: #9e9e9e;
    pointer-events: none;
    transform: translateY(1rem);
    transition: 150ms cubic-bezier(0.4,0,0.2,1);
    background-color: transparent;
    padding: 0 0.2em;
    font-size: 1rem;
}
.input::placeholder {
    color: transparent;
}

.file-upload-form {
    width: 100%;
    height: fit-content;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1.5rem;
}
.file-upload-label input {
    display: none;
}
.file-upload-label svg {
    height: 50px;
    fill: rgba(200, 180, 160, 0.3);
    margin-bottom: 20px;
    transition: fill 0.3s;
}
.file-upload-label {
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
    padding: 30px 20px;
    border-radius: 40px;
    border: 2px dashed rgba(200, 180, 160, 0.2);
    box-shadow: 0px 0px 200px -50px rgba(0, 0, 0, 0.719);
    width: 100%;
    transition: all 0.3s;
}
.file-upload-label:hover {
    border-color: rgba(247, 151, 29, 0.3);
    background: rgba(247, 151, 29, 0.03);
}
.file-upload-label:hover svg {
    fill: rgba(247, 151, 29, 0.4);
}
.file-upload-label.dragover {
    border-color: #f7971d;
    background: rgba(247, 151, 29, 0.06);
}
.file-upload-design {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: rgba(200, 180, 160, 0.4);
}
.file-upload-design p {
    margin: 0;
    font-size: 0.95rem;
}
.browse-button {
    background: rgba(247, 151, 29, 0.1);
    padding: 8px 20px;
    border-radius: 30px;
    color: #e8ddd0;
    transition: all 0.3s;
    border: 1px solid rgba(247, 151, 29, 0.1);
    margin-top: 5px;
    font-weight: 500;
}
.browse-button:hover {
    background: rgba(247, 151, 29, 0.2);
    border-color: rgba(247, 151, 29, 0.3);
    transform: scale(1.02);
}
.file-list {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.file-list .file-item {
    background: rgba(247, 151, 29, 0.06);
    border: 1px solid rgba(247, 151, 29, 0.08);
    padding: 4px 12px 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    color: rgba(200, 180, 160, 0.6);
    display: flex;
    align-items: center;
    gap: 6px;
}
.file-list .file-item .remove-file {
    background: none;
    border: none;
    color: rgba(255,50,50,0.4);
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
    transition: 0.2s;
}
.file-list .file-item .remove-file:hover {
    color: #ff6b6b;
}

.modal .form-actions {
    display: flex;
    gap: 0.8rem;
    margin-top: 2rem;
}
.modal .form-actions button {
    flex: 1;
    padding: 0.8rem 1.2rem;
    border-radius: 40px;
    border: none;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: 0.25s;
    font-family: 'Space Grotesk', sans-serif;
}
.modal .form-actions .btn-submit {
    background: #f7971d;
    color: #0a0808;
}
.modal .form-actions .btn-submit:hover {
    background: #f8a03a;
    transform: scale(1.02);
}
.modal .form-actions .btn-cancel {
    background: rgba(255, 255, 255, 0.04);
    color: rgba(200, 180, 160, 0.5);
    border: 1px solid rgba(247, 151, 29, 0.05);
}
.modal .form-actions .btn-cancel:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e8ddd0;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: rgba(200, 180, 160, 0.3);
    grid-column: 1 / -1;
}
.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}
.empty-state h3 {
    font-size: 1.5rem;
    color: rgba(200, 180, 160, 0.4);
    margin-bottom: 0.5rem;
}
.empty-state p {
    font-size: 1rem;
}

.confirm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 400;
    background: rgba(10, 8, 8, 0.8);
    backdrop-filter: blur(16px);
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.confirm-overlay.open {
    display: flex;
}
.confirm-box {
    background: #14100e;
    border: 1px solid rgba(247, 151, 29, 0.1);
    border-radius: 40px;
    max-width: 420px;
    width: 100%;
    padding: 2.5rem 2rem 2rem;
    text-align: center;
    animation: modalFade 0.2s ease;
}
.confirm-box h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.confirm-box p {
    color: rgba(200, 180, 160, 0.5);
    margin-bottom: 2rem;
    font-weight: 300;
}
.confirm-box .confirm-actions {
    display: flex;
    gap: 0.8rem;
}
.confirm-box .confirm-actions button {
    flex: 1;
    padding: 0.8rem 1.2rem;
    border-radius: 40px;
    border: none;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: 0.25s;
    font-family: 'Space Grotesk', sans-serif;
}
.confirm-box .confirm-actions .btn-confirm {
    background: #ff4444;
    color: #fff;
}
.confirm-box .confirm-actions .btn-confirm:hover {
    background: #ff6666;
    transform: scale(1.02);
}
.confirm-box .confirm-actions .btn-cancel-confirm {
    background: rgba(255, 255, 255, 0.04);
    color: rgba(200, 180, 160, 0.5);
    border: 1px solid rgba(247, 151, 29, 0.05);
}
.confirm-box .confirm-actions .btn-cancel-confirm:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e8ddd0;
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 8, 8, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(247, 151, 29, 0.15);
    color: #e8ddd0;
    padding: 0.8rem 2rem;
    border-radius: 40px;
    font-weight: 500;
    z-index: 500;
    animation: toastSlide 0.3s ease;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    transition: opacity 0.4s;
    display: none;
}
.toast.success {
    border-color: rgba(247, 151, 29, 0.3);
    color: #f7971d;
}
.toast.error {
    border-color: rgba(255, 50, 50, 0.3);
    color: #ff6b6b;
}
@keyframes toastSlide {
    0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
    100% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.admin-badge {
    display: none;
    background: rgba(247, 151, 29, 0.12);
    border: 1px solid rgba(247, 151, 29, 0.15);
    padding: 4px 14px;
    border-radius: 30px;
    font-size: 0.7rem;
    color: #f7971d;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.admin-badge.show {
    display: inline-block;
}

@media (max-width: 1200px) {
    .portfolio-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
    .portfolio-grid { grid-template-columns: repeat(2, 1fr); }
    .modal { padding: 2rem 1.2rem; }
    .project-card .action-buttons { display: flex; }
    .file-upload-label { padding: 25px 15px; }
    .viewer-modal { max-height: 95vh; }
    .viewer-slides .slide { max-height: 40vh; }
    .viewer-slides .slide img,
    .viewer-slides .slide video { max-height: 40vh; }
    .viewer-info { padding: 1rem 1.2rem 1.5rem; flex-direction: column; align-items: flex-start; }
    .viewer-info .viewer-link { align-self: stretch; justify-content: center; }
}
@media (max-width: 500px) {
    .portfolio-grid { grid-template-columns: 1fr; }
    .project-card .card-body { padding: 1.2rem 1.2rem 1.6rem; }
    .file-upload-label { padding: 20px 15px; }
    .file-upload-label svg { height: 40px; }
    .viewer-nav { width: 36px; height: 36px; font-size: 18px; }
    .viewer-nav.prev { left: 8px; }
    .viewer-nav.next { right: 8px; }
}
