/* ==========================================================================
   FRK Soluções Industriais - Portal & Admin Stylesheet
   ========================================================================== */

/* Login Styling */
.login-body {
    background: radial-gradient(circle at 10% 20%, var(--primary-medium) 0%, var(--primary-dark) 90%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text-white);
}

.login-header {
    background: transparent;
    padding: 30px 0;
    position: relative !important;
}

.login-header .logo {
    justify-content: center;
}

.login-wrapper {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 480px;
    border-radius: var(--radius-lg);
    box-shadow: 0 30px 60px rgba(0,0,0,0.4);
    overflow: hidden;
    animation: fadeInUp 0.6s var(--transition-smooth);
}

.login-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.login-tab-btn {
    flex: 1;
    background: rgba(10, 25, 47, 0.4);
    border: none;
    padding: 18px;
    font-family: var(--font-titles);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-tab-btn:hover {
    color: var(--text-white);
    background: rgba(255,255,255,0.03);
}

.login-tab-btn.active {
    color: var(--text-white);
    background: transparent;
    border-bottom: 3px solid var(--accent-red);
}

.login-form-container {
    padding: 40px;
}

.login-intro {
    text-align: center;
    margin-bottom: 30px;
}

.login-intro h2 {
    color: var(--text-white);
    font-size: 1.6rem;
    margin-bottom: 8px;
}

.login-intro p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.login-input {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: var(--text-white) !important;
    padding-left: 45px !important;
}

.login-input:focus {
    border-color: var(--accent-red) !important;
    background-color: rgba(255, 255, 255, 0.08) !important;
}

.input-icon-wrapper {
    position: relative;
    width: 100%;
}

.input-icon-wrapper i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.login-btn {
    width: 100%;
    margin-top: 25px;
    padding: 16px;
}

.login-footer-info {
    text-align: center;
    padding: 20px 40px;
    background-color: rgba(10, 25, 47, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.8rem;
    color: var(--text-light);
}

.login-footer-info a {
    color: var(--accent-red);
    font-weight: 600;
}

/* Alertas */
.alert {
    padding: 15px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 20px;
    display: none;
    align-items: center;
    gap: 12px;
    line-height: 1.4;
}

.alert.active {
    display: flex;
}

.alert-error {
    background-color: rgba(219, 68, 85, 0.15);
    border: 1px solid rgba(219, 68, 85, 0.3);
    color: #ff5f74;
}

.alert-warning {
    background-color: rgba(244, 180, 0, 0.15);
    border: 1px solid rgba(244, 180, 0, 0.3);
    color: #ffd24d;
}

.alert-success {
    background-color: rgba(15, 157, 88, 0.15);
    border: 1px solid rgba(15, 157, 88, 0.3);
    color: #49cc90;
}

/* ==========================================================================
   Portal Dashboard e Layout Geral
   ========================================================================== */
.portal-body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.portal-nav {
    background-color: var(--primary-dark);
    color: var(--text-white);
    padding: 15px 0;
    border-bottom: 2px solid var(--accent-red);
}

.portal-nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.portal-user-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.06);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.user-badge i {
    color: var(--accent-red);
}

.btn-logout {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-white);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-fast);
}

.btn-logout:hover {
    background-color: var(--accent-red);
    border-color: var(--accent-red);
}

.btn-home-portal {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: var(--text-white);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-fast);
}

.btn-home-portal:hover {
    background-color: var(--accent-red);
    border-color: var(--accent-red);
    color: var(--text-white);
}

.dashboard-wrapper {
    flex-grow: 1;
    padding: 40px 0;
}

/* Cabeçalho do Projeto */
.project-header {
    background-color: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.project-title-wrapper h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.project-client-name {
    color: var(--text-medium);
    font-weight: 500;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.project-client-name i {
    color: var(--accent-red);
}

.project-meta-grid {
    display: flex;
    gap: 30px;
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-light);
    letter-spacing: 0.5px;
}

.meta-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-dark);
}

/* Layout em duas colunas */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.8fr 1.2fr;
    gap: 30px;
    align-items: start;
}

.dashboard-card {
    background-color: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    padding: 30px;
    margin-bottom: 30px;
}

.dashboard-card-title {
    font-size: 1.3rem;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.dashboard-card-title i {
    color: var(--accent-red);
}

/* Gráfico Radial de Progresso */
.progress-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

.progress-circle-wrapper {
    position: relative;
    width: 180px;
    height: 180px;
}

.progress-circle-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.progress-circle-bg {
    fill: none;
    stroke: var(--bg-light);
    stroke-width: 12;
}

.progress-circle-val {
    fill: none;
    stroke: var(--accent-red);
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease-in-out;
}

.progress-text-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.progress-percentage {
    font-family: var(--font-titles);
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--primary-dark);
    line-height: 1;
}

.progress-status-badge {
    margin-top: 20px;
    font-size: 0.9rem;
    padding: 6px 16px;
}

/* Linha de Tempo (Timeline) */
.timeline {
    position: relative;
    padding-left: 30px;
    margin-top: 15px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    width: 3px;
    height: 100%;
    background-color: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 30px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -28px;
    top: 6px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background-color: var(--bg-white);
    border: 3px solid var(--accent-red);
    z-index: 2;
    transition: var(--transition-fast);
}

.timeline-item:hover::before {
    transform: scale(1.3);
    background-color: var(--accent-red);
}

.timeline-date {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
}

.timeline-content-card {
    background-color: var(--bg-light);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--border-color);
}

.timeline-item-title {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--primary-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.timeline-item-title span {
    font-size: 0.7rem;
}

.timeline-item-desc {
    font-size: 0.9rem;
    color: var(--text-medium);
    margin-bottom: 15px;
}

.timeline-photo {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    max-height: 250px;
    object-fit: cover;
    width: 100%;
    cursor: pointer;
    transition: var(--transition-fast);
}

.timeline-photo:hover {
    opacity: 0.9;
}

/* ==========================================================================
   Administração - Obras, CRUD, Tabelas
   ========================================================================== */
.admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.table-wrapper {
    background-color: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

.admin-table th {
    background-color: var(--primary-dark);
    color: var(--text-white);
    padding: 15px 20px;
    font-weight: 600;
}

.admin-table td {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.admin-table tbody tr:hover {
    background-color: var(--bg-light);
}

.action-btns {
    display: flex;
    gap: 8px;
}

.btn-action {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition-fast);
}

.btn-edit { background-color: rgba(0, 122, 204, 0.1); color: var(--accent-blue); }
.btn-edit:hover { background-color: var(--accent-blue); color: var(--text-white); }

.btn-timeline { background-color: rgba(244, 180, 0, 0.1); color: #B58000; }
.btn-timeline:hover { background-color: #f4b400; color: var(--text-white); }

.btn-delete { background-color: rgba(217, 37, 37, 0.1); color: var(--accent-red); }
.btn-delete:hover { background-color: var(--accent-red); color: var(--text-white); }

/* Modais de Cadastro / Atualização */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 25, 47, 0.6);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background-color: var(--bg-white);
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.modal-header {
    background-color: var(--primary-dark);
    color: var(--text-white);
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--accent-red);
}

.modal-header h3 {
    color: var(--text-white);
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-white);
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.8;
}

.modal-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    flex-grow: 1;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-light);
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

/* Visualizador de Imagem Ampliada */
.img-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.img-viewer-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.img-viewer-content {
    max-width: 90%;
    max-height: 90vh;
    position: relative;
}

.img-viewer-content img {
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    max-height: 80vh;
}

.img-viewer-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: var(--text-white);
    font-size: 1.8rem;
    cursor: pointer;
}

/* Upload de Imagem em Timeline (Base64) */
.file-upload-wrapper {
    border: 2px dashed var(--border-color);
    padding: 20px;
    border-radius: var(--radius-sm);
    text-align: center;
    cursor: pointer;
    background-color: var(--bg-light);
    transition: var(--transition-fast);
    position: relative;
}

.file-upload-wrapper:hover {
    border-color: var(--accent-red);
    background-color: var(--bg-white);
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-preview {
    margin-top: 15px;
    max-height: 150px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    display: none;
}

/* Responsividade do Portal */
@media (max-width: 992px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .project-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .project-meta-grid {
        width: 100%;
        justify-content: space-between;
    }
}
