/* ============================================================
   DETECTED ELEMENTS
============================================================ */

.detected-elements {
    display: flex;

    flex-wrap: wrap;

    gap: 7px;

    margin-top: 10px;

    padding: 12px;

    min-height: 42px;

    align-items: center;

    background: #f8fafc;

    border: 1px solid #e4eaf1;

    border-radius: 8px;
}


.element-tag {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    padding: 5px 10px;

    background: #eef5ff;

    border: 1px solid #d5e5f8;

    border-radius: 6px;

    color: #2878e5;

    font-size: 13px;
    font-weight: 600;
}


/* ============================================================
   CRYSTAL STRUCTURE INFORMATION
============================================================ */

.structure-information {
    margin-top: 20px;
}


/* ============================================================
   STRUCTURE INFORMATION GRID
============================================================ */

.structure-info-grid {
    display: grid;

    grid-template-columns:
        repeat(8, minmax(0, 1fr));

    gap: 12px;

    margin-top: 14px;
    margin-bottom: 22px;
}


/* ============================================================
   STRUCTURE INFORMATION CARD
============================================================ */

.info-item {
    display: flex;

    flex-direction: column;

    justify-content: space-between;

    gap: 8px;

    min-height: 78px;

    padding: 14px 16px;

    background: #ffffff;

    border: 1px solid #e4eaf1;

    border-radius: 10px;

    box-shadow:
        0 2px 8px rgba(40, 70, 100, 0.045);
}


.info-label {
    font-size: 12px;

    font-weight: 600;

    color: #8493a3;

    text-transform: uppercase;

    letter-spacing: 0.04em;
}


.info-value {
    font-size: 16px;

    font-weight: 700;

    color: #26364a;

    word-break: break-word;
}


/* ============================================================
   LATTICE PARAMETERS
============================================================ */

.lattice-grid {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 12px;

    margin-top: 10px;
    margin-bottom: 22px;
}


.lattice-grid > div {
    padding: 14px 16px;

    background: #ffffff;

    border: 1px solid #e4eaf1;

    border-radius: 10px;

    box-shadow:
        0 2px 8px rgba(40, 70, 100, 0.04);
}


.lattice-grid label {
    margin-top: 0;
    margin-bottom: 7px;
}


/* ============================================================
   CRYSTAL ANGLES
============================================================ */

.angle-grid {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 12px;

    margin-top: 10px;
    margin-bottom: 22px;
}


/* ============================================================
   CRYSTAL ANGLE INFORMATION CARD
============================================================ */

.angle-grid > div {
    display: flex;

    flex-direction: column;

    justify-content: space-between;

    gap: 8px;

    min-height: 78px;

    padding: 14px 16px;

    background: #ffffff;

    border: 1px solid #e4eaf1;

    border-radius: 10px;

    box-shadow:
        0 2px 8px rgba(40, 70, 100, 0.045);
}


/* ============================================================
   ANGLE LABEL
============================================================ */

.angle-grid label {
    margin-top: 0;
    margin-bottom: 0;

    color: #8493a3;

    font-size: 12px;
    font-weight: 600;

    letter-spacing: 0.04em;
}


/* ============================================================
   READONLY ANGLE INPUT
============================================================ */

.angle-grid .unit-input {
    display: flex;

    align-items: baseline;

    gap: 5px;
}


/* ============================================================
   ANGLE VALUE
============================================================ */

.angle-grid input {
    width: auto;
    max-width: none;

    padding: 0;

    margin: 0;

    border: none;

    background: transparent;

    box-shadow: none;

    color: #26364a;

    font-family: inherit;

    font-size: 16px;
    font-weight: 700;

    outline: none;

    cursor: default;
}


/* ============================================================
   ANGLE UNIT
============================================================ */

.angle-grid .unit {
    min-width: auto;

    color: #718096;

    font-size: 13px;
    font-weight: 500;
}

/* ============================================================
   UNIT INPUT
============================================================ */

.unit-input {
    display: flex;

    align-items: center;

    gap: 8px;
}


.unit-input input {
    flex: 1;

    min-width: 0;

    max-width: none;
}


/* ============================================================
   UNIT
============================================================ */

.unit {
    min-width: 28px;

    font-size: 13px;

    font-weight: 600;

    color: #718096;

    white-space: nowrap;
}


/* ============================================================
   MAGNETIC PROPERTIES
============================================================ */

.results-grid {
    display: grid;

    grid-template-columns:
        repeat(2, 1fr);

    gap: 14px;

    margin-top: 16px;
}


/* ============================================================
   RESULT CARD
============================================================ */

.result-card {
    display: flex;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    min-height: 135px;

    padding: 20px;

    background: #ffffff;

    border: 1px solid #e0e8f1;

    border-radius: 12px;

    text-align: center;

    box-shadow:
        0 3px 10px rgba(40, 70, 100, 0.055);
}


/* ============================================================
   RESULT LABEL
============================================================ */

.result-label {
    font-size: 13px;

    font-weight: 600;

    color: #7b8b9c;

    text-transform: uppercase;

    letter-spacing: 0.06em;
}


/* ============================================================
   RESULT VALUE
============================================================ */

.result-value {
    margin-top: 9px;

    color: #2878e5;

    font-size: 28px;

    font-weight: 700;

    line-height: 1.2;
}


/* ============================================================
   RESULT UNIT
============================================================ */

.result-unit {
    margin-top: 5px;

    color: #8a99a9;

    font-size: 13px;

    font-weight: 500;
}


/* ============================================================
   PHASE DATABASE
============================================================ */

.table-wrapper {
    width: 100%;

    margin-top: 20px;

    overflow-x: auto;

    background: #ffffff;

    border: 1px solid #e1e8f0;

    border-radius: 12px;

    box-shadow:
        0 3px 10px rgba(40, 70, 100, 0.05);
}


/* ============================================================
   DATABASE TABLE
============================================================ */

#phaseDatabaseTable {
    width: 100%;

    min-width: 850px;

    border-collapse: collapse;
}


/* ============================================================
   TABLE HEADER
============================================================ */

#phaseDatabaseTable thead {
    background: #f3f7fc;
}


#phaseDatabaseTable th {
    padding: 13px 15px;

    border-bottom: 1px solid #dce5ee;

    color: #47627e;

    font-size: 13px;
    font-weight: 700;

    text-align: left;

    white-space: nowrap;
}


/* ============================================================
   TABLE BODY
============================================================ */

#phaseDatabaseTable td {
    padding: 13px 15px;

    border-bottom: 1px solid #edf1f5;

    color: #334e68;

    font-size: 14px;

    vertical-align: middle;
}


#phaseDatabaseTable tbody tr:last-child td {
    border-bottom: none;
}


/* ============================================================
   TABLE ROW
============================================================ */

#phaseDatabaseTable tbody tr {
    transition: background 0.15s ease;
}


#phaseDatabaseTable tbody tr:hover {
    background: #f7faff;
}


/* ============================================================
   PHASE NAME
============================================================ */

#phaseDatabaseTable td:first-child {
    color: #2878e5;

    font-weight: 700;
}


/* ============================================================
   ELEMENT TAGS INSIDE TABLE
============================================================ */

#phaseDatabaseTable .element-tag {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    margin: 2px;

    padding: 4px 8px;

    background: #eef5ff;

    border: 1px solid #d5e5f8;

    border-radius: 5px;

    color: #2878e5;

    font-size: 11px;
    font-weight: 600;
}


/* ============================================================
   ACTION BUTTONS
============================================================ */

#phaseDatabaseTable button {
    margin: 0;

    padding: 6px 11px;

    border-radius: 6px;

    font-size: 12px;
    font-weight: 600;
}


/* ============================================================
   EMPTY DATABASE
============================================================ */

.empty-database {
    padding: 40px !important;

    color: #9aa8b7 !important;

    font-size: 14px !important;

    text-align: center;
}


/* ============================================================
   RESPONSIVE COMPONENTS
============================================================ */

@media (max-width: 600px) {

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

    .lattice-grid,
    .angle-grid {
        grid-template-columns: 1fr;
    }
}